With the help of Berdir I was able to overwrite the output of the messages menu without losing the dynamic output of new messages.

What I did, was create my own custom module ( name module = MYMODULE ) where I added the following code.

// Privatemsg menu override
function MYMODULE_menu_alter(&$items) {
  // Replace privatemsg_title_callback
  $items['messages']['title callback'] = 'MYMODULE_title_callback';
}


function MYMODULE_title_callback() {

  global $user;

  if ($user) {
    $count = privatemsg_unread_count($user);
  }
  else {
    $count = privatemsg_unread_count();
  }

  if ($count > 0) {
    return t('Inbox (' . $count . ')');
  }
  return t('Inbox');
}

Initial issue can be found here: http://drupal.org/node/1071734

Comments

dunx’s picture

[Edit: Just edited the HowTo instead]