I'd like to use Privatemsg module to send messages to group of users. For this purpose I plan to use a view with Views Bulk Operations (VBO) and plenty of exposed filters.
I was able to create a custom VBO-action that puts the selected users into the recipient field of the message form:
function mymodule_my_custom_action(&$user, $context=array()) {
module_load_include('pages.inc','privatemsg');
$recipients = array();
foreach ($user as $recipient) {
$recipients[] = user_load($recipient->uid);
}
$subject = 'Some subject'
$message_form = drupal_get_form('privatemsg_new', $recipients, $subject);
$message_html = drupal_render($message_form);
}
I'm not very experienced in development so I don't know how to display this form together with the view that helps choosing the recipients. A simple print $message_html;
won't be enough of course. For example would it be possible to use a panel page containing two panes: one for the view of users with VBO and one for the privatemsg form?
Any help would be greatly appreciated!