Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I was wandering what is the recommended way to get a link, where users can send private messages to a group. I wrote something like that.
function custom_misc_privatemsg_group_link() {
// Private message groups installed?
if (!module_exists('privatemsg_groups')) {
return;
}
$group = og_context();
$gid = $group['gid'];
$node = node_load($gid);
$members = og_get_group_members_properties($node, array(), 'members__1', 'node');
$recipients = array();
foreach($members as $uid) {
$recipients[] = user_load($uid);
}
return privatemsg_get_link($recipients);
}
This works, but:
- I have to check permissions manually.
- The private message send form contains names of all recipients, but it would be better to have the groups name in there.
Is there a better way to get such link? Am I missing something?
Comments
Comment #2
ivnish CreditAttribution: ivnish commented