I don't know if there already is a way to do this, but it would be very nice to have a block displaying the contents of the inbox, plus a few commands, such as "send new message" and "manage inbox".

Comments

TDobes’s picture

brihogan’s picture

I made a block that shows:
Inbox (x)
Compose Message

Open "privatemsg.module" and copy the code below to the end of the file (but before the "?>" ).

Hope this helps people. Be sure to keep a backup copy of the original .module since this "hack" may not be perfect. I've only tested it under my circumstances and not under all possibilities. Use at your own risk.

----------------------------- COPY BELOW THIS LINE ----------------------
/**
* Implementation of hook_block().
*/
function privatemsg_block($op = 'list', $delta = 0, $edit = array()) {
if ($op == 'list') {
$blocks[0]['info'] = t('Inbox');
return $blocks;
}
elseif ($op == 'view') {
switch ($delta) {
case 0:
return privatemsg_block_inbox();
}
}
}

function privatemsg_block_inbox() {
global $user;

if (user_access('access private messages') && (isset($user->privatemsg_allow) ? $user->privatemsg_allow : 1)) {

$items = array(l(t('Inbox ('. (int)_privatemsg_get_new_messages() .')'), 'privatemsg'), l(t('Compose Message'), 'privatemsg/msgto'));

$block['subject'] = t('Inbox');
$block['content'] = theme('item_list', $items);

return $block;

}

}

Christefano-oldaccount’s picture

Title: inbox block » Patch to add "Inbox" block to Privatemsg
Version: » 5.x-1.6
StatusFileSize
new1013 bytes

Turned into a patch. I'd really like to see this feature added to privatemsg.

Applied against privatemsg.module,v 1.70.2.19.

Christefano-oldaccount’s picture

Status: Active » Needs review
mindless’s picture

Version: 5.x-1.6 »
Assigned: Unassigned » mindless
Status: Needs review » Fixed

added code based on this to DRUPAL-5 branch.

Christefano-oldaccount’s picture

Priority: Normal » Minor
Status: Fixed » Active
StatusFileSize
new939 bytes

It looks like the path to the Privatemsg inbox has changed.

mindless’s picture

Status: Active » Reviewed & tested by the community

Do you have a preference for that url vs just "privatemsg"? privatemsg/inbox is added just so you can move the menu link around using drupal's menu system, but "privatemsg" is still the inbox too, just as it was before. Unless you prefer to have this patch applied, I'll just leave the block as it is now.

mindless’s picture

Status: Reviewed & tested by the community » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)
gilcpd’s picture

Version: » 6.x-1.2

should I apply both patches? the first one and the other that fixes the private message path?

berdir’s picture

Version: 6.x-1.2 » 5.x-1.6

You should not add anything, this is an old issue and doesn't apply to D6.

Check out http://drupal.org/node/624528