I've installed & set permission for messagebox. As user 1, i'm able to view all users on the messagebox page - but the form in the block only shows "offline users". As a user with access permissions, i don't get any users in the box.
I'm using OG and noticed the og integration - is there any special setting that must be done for them to work?
Is my problem even related to OG...?
Comments
Comment #1
asak commentedUpdate: setting autocomplete off, the block only shows an empty box for "send to:". setting autocomplete only allows me to send messages to the OG group users of the sender group - what i'm assuming is correct (and fit my needs).
So... The problem seems to me to be in the display part of the messenger, since apparently it does know what it's doing ;)
Comment #2
mirian commentedI'm not sure if we have the same problem,
My problem was that if the list-of-users option was chosen (and not the autocomplete option),
the list was empty.
I found a bug in the "_messagebox_get_users" function (line 110).
the query isn't correct, the status of the users is vital to distinguish between offline and online users, and this field is missed in the "select" part, but not in the parameters part, so caused a mistake..
My function look like that:
/**
* helper function
*/
function _messagebox_get_users() {
global $user;
$items = array();
$time_period = variable_get('user_block_seconds_online', 600);
if(!user_access('send global messages') &&
$user->og_groups && count($user->og_groups) > 0) {
$users = db_query("SELECT
u.uid,
u.name,
IF(u.access >= %d, 1, 2) as status /*Miriam add*/
FROM {og_uid} ou INNER JOIN {users} u ON ou.uid = u.uid
WHERE
ou.nid in (%s)
AND u.status > 0
AND ou.is_active > 0
AND u.uid != %d
AND u.uid != 0
AND u.login != 0
AND u.status = 1
ORDER BY
u.status, u.name",
time() - $time_period,
implode(',',array_keys($user->og_groups)),
$user->uid);
}
else {
$users = db_query('
SELECT
uid,
name,
IF(access >= %d, 1, 2) as status
FROM
{users}
WHERE
uid != 0
AND uid != %d
AND status = 1
ORDER BY
status, name', time() - $time_period, $user->uid);
}
while($uid = db_fetch_object($users)) {
if($uid->status == 1) {
$items[t('on-line users')][$uid->uid] = _messagebox_shorter_name($uid->name);
}
else {
$items[t('off-line users')][$uid->uid] = _messagebox_shorter_name($uid->name);
}
}
return $items;
}
Hope it will help others!!
Miriam.
Comment #3
asak commented@Miriam: Added the line you specified, but i get the following error:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF(u.access >= 1206345226, 1, 2) as status /*Miriam add*/ FROM og_uid ou' at line 4 query: SELECT u.uid, u.name IF(u.access >= 1206345226, 1, 2) as status /*Miriam add*/ FROM og_uid ou INNER JOIN users u ON ou.uid = u.uid WHERE ou.nid in (53,16) AND u.status > 0 AND ou.is_active > 0 AND u.uid != 16 AND u.uid != 0 AND u.login != 0 AND u.status = 1 ORDER BY u.status, u.name in /home/seferish/public_html/intra/includes/database.mysql.inc on line 172
And no names appear in the box.
However, simply adding "global $user;" as described at http://drupal.org/node/211094 solved the issue.
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.