How do I hide "Who is online" box to guests /people who are not logged in? Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
2 posters

    How do I hide "Who is online" box to guests /people who are not logged in?

    avatar
    johns
    New Member


    Posts : 1
    Reputation : 0
    Language : English

    How do I hide "Who is online" box to guests /people who are not logged in? Empty How do I hide "Who is online" box to guests /people who are not logged in?

    Post by johns February 6th 2011, 6:01 am

    I have looked around and tried to do it myself to no avail.

    I want to hide the box with "Who is online" from guests. If I need to get rid of it altogether that is fine too.

    Thank you in advance.

    xx3004
    xx3004
    New Member


    Male Posts : 13
    Reputation : 0
    Language : English, Vietnamese

    How do I hide "Who is online" box to guests /people who are not logged in? Empty Re: How do I hide "Who is online" box to guests /people who are not logged in?

    Post by xx3004 February 6th 2011, 10:20 am

    Hi,

    This is my own code, and it works fine for me.

    Go to: Administrator Panel > Forum Widgets Management > Create new Widget > Copy the code below into the text area, save it and drag it into the widgets table to make it appear on the page (Use table type > No):

    Code:
    <script language="javascript" type="text/javascript">
    if(jQuery("#logout").html()!=null)
       {//Return username if member is logging in
       user_name=jQuery("#logout").html().split("[ ")[1].split(" ]")[0];
       }
    else
       {//Return null for guest
       user_name=null;
       }
    //If user_name=null (guest) => hide the table "Who is online"
    if(user_name==null){jQuery("table .forumline").css("display", "none");}
    </script>

    It works for me, tell me if it works for you, too.
    Besides, after running the code (without the last entry), if you know about javascript and can also do various stuffs since the user_name will return the member's username for member and return null for guest!
    Enjoy,

    Credit by xx3004,