Hiding chat box display from non-logged in members

Hello WPmudev team,

Just wondering if its possible to Not display the chat box if the user is not logged in, as in my case for example, the chat box is allocated to logged in contributors only, yet if a web user comes by, he can see the box but obviously they cant do anything given 1) Not logged in and 2)Not an active contributor.

If this can be accomplished at this time or included in a future release, it would be appreciated.

  • Paul
    • The Green Incsub

    @Fanaticweb, This can be done if you select only the 'WordPress user' as the authentication method. See screenshot and see note on screenshot reading

    "Authentication methods users can use. If only 'WordPress user' is selected then chat will be hidden from non-authenticated users."

  • Fanaticweb
    • WPMU DEV Initiate

    That was pretty quick, thanks Mansoor, although I am clueless as to which file exactly this modification would apply to, sorry am a "noob".

    Wouldn't it be in the plugin's folder itself that I would need to modify the code instead of the theme itself?

  • mansoormb
    • Design Lord, Child of Thor

    @Fanaticweb

    Well Paul's suggestion works only if you have the top checked and have facebook and admin unchecked! But I am not sure where you would need to put the code yet!

    Is your chat feature a plugin? Or is it built into the the site? If its a plugin let me know what it is so I can tell you how to hide it :slight_smile:!

    Mansoor

  • Fanaticweb
    • WPMU DEV Initiate

    Wow guys, one at a time lol
    Paul: Yes BUT its a NSFW site (go figure), I'll install it on a clean demo site using the same theme just for kicks and see what happens.

    @mansoormb Great, but I cant use FB, I just want it visible to Logged in users who are assigned the Contributor role

  • mansoormb
    • Design Lord, Child of Thor

    I am a little confused on why Paul's solution isn't working for you and you didn't mention if the chat was a plugin or not?

    Also you stated only the contributor role, are there going to be other roles besides the admin for the site?

    I would really like a sample of the code in question if you can

  • Fanaticweb
    • WPMU DEV Initiate

    I'm a bit confused too, I just installed the Chat plugin on a demo site: asmtl . net , not even logged in and the bottom chat box is still there, I tried clearing cookies thinking maybe the plugin is injecting one but to no avail.

    Technically you guys should not see the Chat box at the bottom when accessing the site.

    As for the roles, there's the Admin, Contributors (default role for registered users) and Limited_users (created using the Members plugin), only the Admin and the contributors will have access to the Chat option, so far thats working fine, its just the initial appearance of the chat box that's not pleasant as this will confuse external and non-allocated users thinking there's a chat system they can use yet thats not the case.

  • Fanaticweb
    • WPMU DEV Initiate

    By the way, just to reinforce the whole point of this posting, its not the fact that non-authorized users are able to chat, its just seeing the "Click here to chat" box in the bottom corner of the site that I'm trying to get rid of for the non-members, that way at least only the Contributors will know that once they login, they will see that chat box option.

    The more I think about it, it would've made sense to be able to insert the Chat into a Widget and show it in the User's dashboard account since they need to login to access that section of the site(Custom Dashboard, not the default WP panel), any way this can be done as well?

    Apologies if this last one is off topic.

  • Paul
    • The Green Incsub

    @Fanaticweb, Appears there might be a bug on the bottom corner logic. On your site I can see the box for chat but cannot expand it to show the chat details. Can you confirm that? I'll start looking at the chat code. See if we can get this patched for you.

  • Fanaticweb
    • WPMU DEV Initiate

    Hey Paul, I wasnt worried about the fact that you cant open the chat box, same thing from my end if i"m not logged in to the site, it works fine once logged in as an admin or contributor, its just that you weren't supposed to see it at all since you're not logged in, am I correct to think so?

  • Paul
    • The Green Incsub

    @Fanaticweb, The intended functionality was that that the bottom corner chat should be hidden completely. The fact that you can't expand it tells me this is partially working correct. So let me look at the code and see abut hiding the frame wrapper.

    As for the other comment. Yes, I intend to add a admin dashboard widget to show only logged in users. But still other members want a front-facing way to also do this.

    Will get back to you shortly on the other issue.

  • Fanaticweb
    • WPMU DEV Initiate

    This is very interesting! I just uploaded the beta version, and YES the box is gone when not logged in, that's just perfect :slight_smile:

    I do see some code in the footer's bottom:

    site_login_options
    Array
    (
        [0] => current_user

    Not sure if this is just for debug or troubleshooting purposes.

    I also noticed that when logged in and on the homepage, the box wont expand, yet any other page I navigate to, it will expand, just wondering if it was set that way on purpose?

  • Fanaticweb
    • WPMU DEV Initiate

    Oops sorry I didn't mean to ignore the followup on this thread, I never received the email notification??

    Granted for the possible JS conflict, I'll look into it with the theme's developers.

    Thank you for the prompt help and support Paul.

  • Fanaticweb
    • WPMU DEV Initiate

    Paul, you were right, the issue was caused by another plugin which apparently was not compatible with WP 3.5, clearly, I deactivated the legacy plugin and the Chat box works flawlessly.

    Thank you once again for your premium support.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.