By CreativeMe on
Ok I would like to work if they are online and there role.
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 = "";
}
?>
Now I need to only display them if they are online in a session am losted how to do this with the sql.
If someone has the time would they mind helping me please.
Comments
Did you look at user.module
Did you look at (under user_block, about line 577 in 5.1)?
Also, is there a reason you're not using an array of role ids and looping through? Having so much repetitiveness could get very hairy if you need to change something.
I have looked at that code
I have looked at that code yes
This is where I am at now.
[code]
[/code]
I can not see where I have gone wrong?
I get this error Parse error: syntax error, unexpected $end in C:\xampplite\htdocs\d\includes\common.inc(1342) : eval()'d code on line 24
=-=
your parse error could be because you don't use any closing }'s
I've been using something
I've been using something like this, but I'm not sure how a 3-way INNER JOIN would work.
I had a go at making the
I had a go at making the 3-way INNER JOIN but could not get it to work
[code]
[/code]
Unsure where I have gone wrong with this.
Got it!!
You've probably found a better solution, but this seems to work for me (for future readers). It's extraordinarily wasteful and slow, but it works.
Did u got it to work ?
i am looking for a similar solution to see who's online as the default drupal 7 block is lacking some features.
I tried your code and it doesen't seem to work.