This is an old issue. Despite numerous reports from users annoyed by it, it has not been fixed.

After each blog post, Drupal displays a link called "$user's blog", on both the front page and on each individual node page. This might be useful in some situations, but in other cases it's just annoying. There is no way to turn it off, other than patching the core.

Reproduce the bug:
Just post a few blog nodes.

I expected to be able to go to the Admin section and turn off the display of the "$user's blog" link.

Instead, there's no easy way to turn it off, other than hacking the core.

Some discussions and patches:

http://drupal.org/node/21373

http://www.thesitewizard.com/blogging/remove-username-from-drupal-blog.s...

CommentFileSizeAuthor
#22 blog.module.patch507 bytesflorin
#9 blog.module.patch481 bytesflorin
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lomz’s picture

I would love to get that line removed,

whirledview’s picture

subscribed.

WorldFallz’s picture

Status: Active » Fixed

AFAIK, this is not true. Try the following in the template.php file for your theme (be sure to empty the cache):

<?php
function phptemplate_links($links, $attributes = array()) {
    unset($links['blog_usernames_blog']);
    return theme_links($links, $attributes);
}
?>

I can verify it works in d6.9.

Dave Reid’s picture

Or use hook_link_alter in a custom module:

function hook_link_alter(&$links, $node) {
  if (isset($links['blog']['blog_usernames_blog'])) {
    unset($links['blog']['blog_usernames_blog']
  }
}
lomz’s picture

Couldnt that be put in a module and shared with eveyone?

WorldFallz’s picture

I suppose it could-- but creating and maintaining a whole module for 3 lines of code? Doesn't seem very worthwhile to me....

lomz’s picture

Then I'll do it, I have been sick of doing this manually, I am sure I am not the only one.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

florin’s picture

FileSize
481 bytes

Patch for 6.10 disabling $username's blog - see attached file.

bendshead’s picture

How do you implement a (this) patch in Drupal?

WorldFallz’s picture

See http://drupal.org/patch/apply

However, patching a core module is not a good idea-- you essentially create a fork that must be manually maintained through every drupal upgrade going forward. This is particularly true when what you're trying to accomplish is easily handled with an override as described in the comments above.

bendshead’s picture

I'm using Drupal 6.10 and tried the override under comment #3. It is causing issues, however.

In IE, my site just hangs -- never loads page. In Firefox, I receive the below error message.

* warning: Cannot modify header information - headers already sent by (output started at mysite/www/themes/litejazz/template.php:3) in mysite/www/includes/common.inc on line 141.
* warning: Cannot modify header information - headers already sent by (output started at mysite/www/themes/litejazz/template.php:3) in mysite/www/includes/common.inc on line 141.
* warning: Cannot modify header information - headers already sent by (output started at mysite/www/themes/litejazz/template.php:3) in mysite/www/includes/common.inc on line 141.
* warning: Cannot modify header information - headers already sent by (output started at mysite/www/themes/litejazz/template.php:3) in mysite/www/includes/common.inc on line 141.
* warning: Cannot modify header information - headers already sent by (output started at mysite/www/themes/litejazz/template.php:5) in mysite/www/includes/common.inc on line 141.

WorldFallz’s picture

@bendshead that's usually caused by some misbehaving whitespace-- double check you don't have any stray characters in the template.php file (especially at the very top or bottom). Also, make sure you don't have a closing ?> at the bottom of the file.

-Anti-’s picture

Status: Closed (fixed) » Active

Sorry to resurrect this.

The link itself is very useful.
It's just the incorrect implementation of the apostrophe that is embarrassing.

So how would you just get rid of the 's, but leave the link?
Eg. link reads: Fred blog

Or better, get rid of the name and apostrophe completely, but leave the link?
Eg. link reads: Blog or ideally: Go to Blog

Note that this link should be translatable using the locale module.
Also, the fix needs to apply to the blog TITLE too!.

When you build a website for your company, and your boss has a name ending
with 's', this is an extremely embarrassing bug.

Thanks.

WorldFallz’s picture

Status: Active » Fixed

It's passed through t() so it is translatable. But links are easily manipulated.

Put the following in your template.php file:

function phptemplate_links($links, $attributes = array()) {
  $links['blog_usernames_blog']['title'] = t('Go to Blog');
  $links['blog_usernames_blog']['attributes']['title'] = t('Go to Blog');
  return theme_links($links, $attributes);
}
-Anti-’s picture

Sorry I get this error:

Fatal error: Cannot redeclare phptemplate_links() (previously declared in /home/USER/public_html/dev/sites/all/modules/menutrails/menutrails.module:428) in /home/USER/public_html/dev/sites/all/themes/THEME/template.php on line 64

I noticed these two modules, which will help with the blog title:
http://drupal.org/project/blogtitle
http://drupal.org/project/advanced_blog

But they don't do anything to the link at the bottom of the blog posts.
So thanks for any further input.

WorldFallz’s picture

That means you already have a phptemplate_links function somewhere in the template.php-- you can just add the following to that existing function (before the return statement):

if ($links['blog_usernames_blog']){
  $links['blog_usernames_blog']['title'] = t('Go to Blog');
  $links['blog_usernames_blog']['attributes']['title'] = t('Go to Blog');
}

(that first 'if' should have been in the code above as well)

-Anti-’s picture

Sorry... but it's not in the template.php, it's in the menutrails module.
I guess this means that I can't use this particular fix.

WorldFallz’s picture

Nope--- just change the function name to yourtheme_links and put it in the template.php file (or add #17 to any existing yourtheme_links function). If all else fails, it can be done in a little custom module (as mentioned by DR in #4) but try this first.

-Anti-’s picture

> Nope--- just change the function name to yourtheme_links

Ah... thanks! I'll try that later.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

florin’s picture

Status: Closed (fixed) » Active
FileSize
507 bytes

No changes for 6.13, same patch essentially.

WorldFallz’s picture

patching the core blog module while other non-core destructive methods exist is not recommended.

WorldFallz’s picture

Status: Active » Fixed
willeaton’s picture

Updated code due to some typos and mistakes/changes in versions...
This in a module using the hook_form_alter() will remove the link...

<?php
function MYMODULE_link_alter(&$links, $node) {
  if (isset($links['blog_usernames_blog'])) {
    unset($links['blog_usernames_blog']);
  }
}

Thanks
Will Eaton
Drupal Developer
http://www.williameaton.co.uk

cside’s picture

If anyone is interested this can be removed with css:

#content .blog_usernames_blog {display: none;}

Hope that helps someone looking for a quick fix.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

smscotten’s picture

@-anti-

If your boss's name ends with an 's', you should add an apostrophe and an 's' to make the possessive eg "James's blog". The current behavior is correct.

Exception: if your boss is royalty or a prophet eg "Moses' laws" or "Prince Charles' ears"

I guess the other exception is if you have two bosses named James and they both share the same blog. That would be "James' blog".

None of this changes your point, of course.

-Anti-’s picture

Thanks for your input. There are a couple more relevant exceptions though:

My boss's name ends in a hard 'z' sound.
Eg. Mr Chambers should become Mr Chambers' blog

Also we have some employees' names with double ss endings.
Eg. Mr Moss should become Mr Moss' blog

This application is debatable (as some people would write Mr Moss's)
But I don't like it; it looks more formal, neat and professional the other way.

Cheers.

-Anti-’s picture

Having just got round to revisit this issue again, I now understand that all
the fixes in this thread only apply to the link at the bottom of a node.

What I really need is to stop the TITLE appearing at the TOP of the blog teaser page.
Or even better, change it so it reads: Blog: $USERNAME

Is there any way to do that?

I can see the following in the blog module:

function blog_page_user($account) {
  global $user;
  drupal_set_title($title = t("@name's blog", array('@name' => $account->name)));
...

And I guess I'd like to edit that to:

drupal_set_title($title = t("Blog: @name", array('@name' => $account->name)));

but I have no idea how to do that without hacking the module itself.

Cheers.

WorldFallz’s picture

You could adapt a function to do the possessive:

function mymodule_possessive($string) {
  return $string.'''.($string[strlen($string) - 1] != 's' ? 's' : '');
}
WorldFallz’s picture

@#30:

You might be able to do that in a node preprocess function with http://api.drupal.org/api/function/drupal_set_title

-Anti-’s picture

Sorry, I edited my post while you typed your reply.

OK, I kind of understand that script; it seems it would work for my purpose.

Where would I put it so that it over-rides the blog module?
Would I really call it 'mymodule_possessive'?

Perhaps avoiding the possessive altogether might be better?
Eg. Blog: @name would do fine.

Thanks.

-Anti-’s picture

> You might be able to do that in a node preprocess function with http://api.drupal.org/api/function/drupal_set_title

Sorry, that means absolutely nothing to me.
I couldn't even print 'hello world' in php without having to look up how to do it.

EDIT1:

Is putting the following script in template.php close to what you mean?

function THEME_preprocess_blog_page_user {
drupal_set_title($title = t("Blog: @name", array('@name' => $account->name)));
}

I really haven't a clue.

EDIT2

This doesn't appear to work, but am I getting close?

function fusiontheme_preprocess_blog_page_user (&$vars) {
$vars ['title'] = t("Blog: @name", array('@name' => $account->name));
}

EDIT3:

Just shooting in the dark now:

function fusiontheme_preprocess_blog_page_user ($title) {
$title['title'] = t("Blog: @name", array('@name' => $account->name));
return drupal_set_title($title);
}

OK, those were my best attempts after 2 hours and hundreds of tries.
I have no idea what to do next.
Thanks for any assistance.

WorldFallz’s picture

i played around with this quite a bit and couldn't get it to work right in the theme layer (i never use the blog module). I think it probably has to be done in a module. If I get a chance to figure it out i'll post back.

-Anti-’s picture

For now, I've just edited line 15 in blog.pages.inc:
drupal_set_title($title = t("Blog: @name", array('@name' => $account->name)));

Obviously that isn't very good practice though.

Thanks.

mshepherd’s picture

#4 worked after slight modification as follows:

<?php
function overrides_link_alter(&$links, $node) {
  if (isset($links['blog_usernames_blog'])) {
    unset($links['blog_usernames_blog']);
  }
}
?>
David_Rothstein’s picture

See also #792062: Blog links don't make sense for a single-user blog which would try to make the blog module a little smarter automatically about when to show this link.

wa2nlinux’s picture

#3 Work well on my site

TechMagician’s picture

#26 worked for me, implemented the CSS using module: http://drupal.org/project/css_injector

cookiesunshinex’s picture

#3 works on Drupal 6.20 for me.

It works with Opera, Safari, Chrome, and Firefox on Mac OS X.

eddison’s picture

Version: 6.5 » 6.22

Ok for those of us who don't eat code for din din's (like me) here is a newbie guide:
As was stated above post number 26 worked on my site http://translationof.com i have the blogs organised as a type of forum, which suits my purposes. I have 6.22, not drupal 7 so recent modules don't work. but this solution is elegant.
I uploaded this module http://drupal.org/project/flexible_blogs which allows one to place code in drupal (especially if you don't know where to put it, and no one is telling you!). Enable module, give yourself permission (you deserve it) and go to;
site configuration
CSS injector Then click
'create new rule' then call it something like remove username blog like, then place this code in the window
#content .blog_usernames_blog {display: none;}
And click save.
Now all links like someone's blog should be gone!!
Thanks to cside for the code, and David_Rothstein for the nice module!

klidifia’s picture

Thanks this is much simpler...
Also this stuff appears in the breadcrumbs!
This is what I did...

Created a new template file: node-blog.tpl.php
Added this css at the top:
#content .blog_usernames_blog {display: none;}
#breadcrumbs {display: none;}

MarioTorresp’s picture

Version: 6.22 » 7.12

In Drupal 7 edit only node.tpl.php:

unset($content['links']['blog']['#links']['blog_usernames_blog']);

chaiwei’s picture

For drupal 7, I am using hook_node_view_alter()

function modulename_node_view_alter(&$build) {
  if (isset($build['links']['blog']['#links']['blog_usernames_blog'])) {
    unset($build['links']['blog']['#links']['blog_usernames_blog']);
  }
}
RobertOak’s picture

ditto #45 works for D7

knalstaaf’s picture

#45 works indeed, but modulename is themename in my case (and it's put in my template.php).

Thanks.

kkalaskar’s picture

Thanks chaiwei, #45 Worked for me.

function MODULE_NAME_node_view_alter(&$build){
if($build['#bundle'] == 'blog' && isset($build['links']['blog']['#links']['blog_usernames_blog'])){
unset($build['links']['blog']['#links']['blog_usernames_blog']);
}
}
Als’s picture

Issue summary: View changes

A quick and focused solution for D7 is explained on Templatemonster.

In short:
- open current theme's node.tpl.php
- find "hide( $content[‘field_tags’] )"
- add "hide($content['links']['blog']);"

See their page for details:
https://www.templatemonster.com/help/drupal-7-x-how-to-remove-admins-blo...

jorgemontoyab’s picture

#45 + #47 worked for me. Thanks!

mdalda’s picture

template.php version:

function TEMPLATE_preprocess_page(&$vars) {
  if ($vars['node']->type == 'blog') {
    unset ($vars['page']['content']['system_main']['nodes'][$vars['node']->nid]['links']['blog']);
  }
}