Closed (fixed)
Project:
Privatemsg
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Feb 2011 at 14:03 UTC
Updated:
17 Mar 2011 at 12:41 UTC
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
Comment #1
berdirprivatemsg_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.
Comment #2
Donaldd commentedThanks 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
Comment #3
berdirThanks, I made some small adjustments, looks good otherwise.