I have a flag on my Drupal 7 site for alerting moderators regarding potential abuse.
I want a link to this flag to be displayed next to the
Block links on the view private message screen (messages/view) provided by the Private Message module.
By inserting the following code below the code for the delete link (line 769) in the latest version of the module, I can render the link correctly.
$author = $vars['message']->author; $vars['message_actions'] = array('title' => t('Report abuse'), 'href' => 'flag/confirm/flag/abuse/flag/block/' . $author->uid . '?destination=user/' . $author->uid );
However, I don't want to hack the module; I want to add this code to a custom module. hook_privatemsg_message_view_alter() appears to be the function for this, but I don't understand how to use it. Simply inserting the above code and calling the function from within my custom module does not result in any errors but the link is not displayed. What do I need to show the link?
EDIT: The solution need not use
hook_privatemsg_message_view_alter(); if there is a better way that doesn't involve hacking privatemsg, I'd be happy to hear of it.