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:

  1. I have to check permissions manually.
  2. 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

gunwald created an issue. See original summary.

ivnish’s picture

Status: Active » Closed (outdated)