Hi,

I want to overwrite the link to messages, so that instead of "Messages (1 new)" it shows "Messages (1)"

I tried doing this in template.php with the following code but that didn't work.

function tomstuff_privatemsg_title_callback($account = NULL) {
  if ($account) {
    $count = privatemsg_unread_count($account);
  }
  else {
    $count = privatemsg_unread_count();
  }

  if ($count > 0) {
    return format_plural($count, 'Messages (1)', 'Messages (@count)');
  }
  return t('Messages');
}

I don't want to hack the module, but is there then maybe another way to achieve this?

Thanks,
D

Comments

berdir’s picture

Status: Active » Postponed (maintainer needs more info)

privatemsg_title_callback is not a theme function, you can not override it like that. You can only override functions like that if they start with 'theme_'.

There are two options to do this:

- You can use string_overrides: http://drupal.org/project/string_overrides

- You can imp> http://api.worldempire.ch/api/privatemsg/privatemsg.module/function/priv...

lement hook_menu_alter() and then set a different 'title callback' for $menu['messages']. Note that you need to do this in a module, not a theme. See http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hoo... and http://api.worldempire.ch/api/privatemsg/privatemsg.module/function/priv...

Report back if that works or if you need more help. You're also welcome to create a how-to on how to do that below that documentation page http://drupal.org/documentation/modules/privatemsg.

Donaldd’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thanks Berdir! Your help saved my ass again. :p

I also created an HowTo page that can be found here: http://drupal.org/node/1079872

Many Thanks,
D

berdir’s picture

Thanks, I made some small adjustments, looks good otherwise.

Status: Fixed » Closed (fixed)

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