Ok I the Display I am trying to get it

Admin *Name
*Name
Mod< There Role
*Name
*Name

I would out how to list the roles with the code here.

<?php
print "<br>3";
$rid3 = 3;
$result = db_query("SELECT u.uid, u.name, u.status FROM {users} u
INNER JOIN {users_roles} ur ON u.uid=ur.uid WHERE ur.rid = %d
AND u.status = 1", $rid3);
while ($u = db_fetch_object($result)) {
  $items[] = l($u->name, "user/" . $u->uid);
}
print theme('item_list', $items);
$items = "";
print "<br>4";
$rid4 = 4;
$result = db_query("SELECT u.uid, u.name, u.status FROM {users} u
INNER JOIN {users_roles} ur ON u.uid=ur.uid WHERE ur.rid = %d
AND u.status = 1", $rid4);
while ($u = db_fetch_object($result)) {
  $items[] = l($u->name, "user/" . $u->uid);
print theme('item_list', $items);
$items = "";
}
print "<br>5";
$rid5 = 5;
$result = db_query("SELECT u.uid, u.name, u.status FROM {users} u
INNER JOIN {users_roles} ur ON u.uid=ur.uid WHERE ur.rid = %d
AND u.status = 1", $rid5);
while ($u = db_fetch_object($result)) {
  $items[] = l($u->name, "user/" . $u->uid);
print theme('item_list', $items);
$items = "";
}
print "<br>6";
$rid6 = 6;
$result = db_query("SELECT u.uid, u.name, u.status FROM {users} u
INNER JOIN {users_roles} ur ON u.uid=ur.uid WHERE ur.rid = %d
AND u.status = 1", $rid6);
while ($u = db_fetch_object($result)) {
  $items[] = l($u->name, "user/" . $u->uid);
print theme('item_list', $items);
$items = "";
}
?>

but I can not work out how to add the the db_query if they are online right at this time or not?
I also belive this could be a good feature to add onto Drupal.

Comments

CreativeMe’s picture

No idea what happand on the 1st message...

I would like to display there roles that are online like

Admin< Roles
*Name
*Name
Mod< Role
*Name
*Name

I have out work out to get there role but can not work out the sql to get it to check if they online or not

print "Online Admin";
$rid3 = 3;
$result = db_query("SELECT u.uid, u.name, u.status FROM {users} u
INNER JOIN {users_roles} ur ON u.uid=ur.uid WHERE ur.rid = %d
AND u.status = 1", $rid3);
while ($u = db_fetch_object($result)) {
  $items[] = l($u->name, "user/" . $u->uid);
}
CreativeMe’s picture

What have i done wrong?

print "Online Admin";
$rid3 = 3;
$interval = time() - (600);
$active_users = db_query('SELECT u.uid, u.name FROM (users) u INNER JOIN (sessions) s ON (u.uid = s.uid) INNER JOIN (User_roles) ur ON (u.uid = ur.rid) WHERE ur.rid = 3 AND s.timestamp >= %d AND s.uid > 0  AND u.status != 0 ORDER BY s.timestamp DESC', $interval);// Errors on the query
    while ($account = db_fetch_object($active_users)) {
        $active_users[] = l($u->name, "u.user/" . $u->u.uid);
        }
ricabrantes’s picture

Status: Active » Closed (fixed)

No activity, Closed....