I used this tip to put private the Drupal 7 private messages into blocks, in order to put those blocks on a quicktabs block:
<?php
/**
* Implements hook_block_info().
*/
function MYMODULE_block_info() {
$blocks = array();
$blocks['messages_list'] = array(
'info' => t('Messages List'),
'cache' => DRUPAL_NO_CACHE,
);
$blocks['messages_sent'] = array(
'info' => t('Sent Messages'),
'cache' => DRUPAL_NO_CACHE,
);
$blocks['new_message'] = array(
'info' => t('New Private Message'),
'cache' => DRUPAL_NO_CACHE,
);
return $blocks;
}
/**
* Implements hook_block_view().
*/
require_once('sites/all/modules/privatemsg/privatemsg.pages.inc');
function MYMODULE_block_view($delta = '') {
$block = array();
switch ($delta) {
case 'messages_list':
global $user;
$block['subject'] = t('Private Messages List');
$block['content'] =
drupal_get_form('privatemsg_list', 'list', $user);
break;
case 'messages_list':
global $user;
$block['subject'] = t('Private Sent Messages');
$block['content'] =
drupal_get_form('privatemsg_list', 'sent', $user);
break;
case 'new_message':
$block['subject'] = t('New Private Message');
$block['content'] = drupal_get_form('privatemsg_new');
break;
}
return $block;
} ?>
It works quite well, but I have the following issues:
- Tab 1 (Inbox): Why I can't delete messages on the message list, or change their status.
- Tab 2 (Sent messages): How do I see the sent messages list? Is there a separate form?
- Tab 3 (New message): After sending a new message, how to I redirect the user back to the messages list?
- How to avoid needing to include sites/all/modules/privatemsg/privatemsg.pages.inc (If I want to put this block on a non-standard URL, not starting with '/messages', I get an error that a function in that file is not found.
Notes (EDITED):
Drupal 7 Privatemsg views integration module is stuck (you can see the latest patch here). Forms integration works, somewhat.
Alternate approachers:
- Edit it with the data module (which allows to make a view on any table) + VBO. IF they work together.
- Recreate the whole solution with Views + VBO.
Please advise
Thanks
Amnon