simple integration of the parts of 2 modules -private msg and privatemsgmm
Hey,
On the private message module, the user is able to selct their buddies. I have identified the code allowing for this as:
$contacts = array();
while ($name = db_fetch_object($result)) {
$username = check_plain($name->name);
$contacts[$username] = $username;
}
if (module_exists('buddylist')) {
$result = db_query('SELECT u.name FROM {buddylist} b, {users} u WHERE b.buddy = u.uid AND b.uid = %d', $user->uid);
while ($name = db_fetch_object($result)) {
$buddyname = check_plain($name->name);
$contacts[$buddyname] = $buddyname;
}
asort($contacts);
}
global $user;
if (in_array('Club/Society',$user->roles))
{array_unshift($contacts, t('Club Members'));}
else {array_unshift($contacts, t('Club Administrators'));}
$form['quick'] = array(
'#type' => 'select',
'#options' => $contacts,
'#attributes' => array('style' => 'display: none;'), // hidden unless JS is working
'#suffix' => ''
);
And in private message mass mailer you can select any user. Using the following code:
function _privatemsgmm_users() {
$users = array();
$res = db_query ('SELECT uid, name FROM {users} WHERE uid > 1 ORDER BY name');
while ($row = db_fetch_object($res)) {
$users[$row->uid] = $row->name;
}
return $users;
}
But I'd like the user to only be able to select users from their buddylist in private message mass mailer.
So, I'd like to move the code from private message to private message mass mailer.
Could someone please help??'
This would be a good contribution to the drupal community,
regards
