Adding a "my messages (x)" link in the block template file I have installed Privatemsg, and I need to output the "My messages (x)" link programmatically in block.tpl.php.

I tried the following code, but it only prints "My Messages", when I need a counter for the new messages:

print l('My messages', 'messages');
The module already contains a block that does something similar: "New message indication". You can use that block and alter the output if needed by overriding the theme_privatemsg_new_block() function.