Who's Online available to guests as well

edited January 2008 in Vanilla 1.0 Help
"Who's Online available to guests as well" how can i do that

Comments

  • Whenever you see this in the code:

    if ($Context->Session->UserID > 0) { ... }

    That's a condition to eliminate guests. Get rid of that "if" statement. If the clause is a "if ... else ...", get rid of the "if" condition, and then get rid of everything under the "else".

    Are you following me?
  • no i don't u think u understood what i asked what i wanted was so that the guests could see who is online is that what u answered or did u answer how to remove the guests from the online list? thanxz
  • I was trying to point you in right direction without actually looking at the extension... Umm, in WhosOnline, at lines 149 & 150, you see:

    if (in_array($Context->SelfUrl, array("account.php", "categories.php", "comments.php", "index.php", "post.php", "search.php", "settings.php")) && $Context->Session->UserID > 0 && !$Context->Session->User->Preference("HideWhosOnline")) {

    That "$Context->Session->UserID > 0" condition is what's keeping guests from seeing the WhosOnline Panel (I believe)... Now that I look at it, it's not quite as simple as erasing the condition (because there's a preference involved). You would probably need to change it to:

    if (in_array($Context->SelfUrl, array("account.php", "categories.php", "comments.php", "index.php", "post.php", "search.php", "settings.php")) && !($Context->Session->UserID > 0 && $Context->Session->User->Preference("HideWhosOnline"))) {

    Note the NOT operator ("!") and the parenthesis. Try that out. It might work, or it might not. If it doesn't, I would have to look deeper at the code to see what else is going on.
  • thanx i will try it out and tell u what happens
  • sweet it worked thanxz
This discussion has been closed.