Support » Plugin: Simple Ajax Chat » View only allowed if Require users to be logged in set

  • Resolved Larry Lewis

    (@jenolan)


    Hi,

    Just tinkering with the chat widget, what I would like is that there be an option to always show the chat but only logged in users can post. I have twiddled the settings but this doesn’t seem possible at the moment.

    Could this be added please.

    Cheers,
    Larry

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Did you try the setting, “Require log in”? It’s like the 3rd option on the SAC settings page. When enabled, it hides the chat box unless the user is logged in.

    Thread Starter Larry Lewis

    (@jenolan)

    I have that what I would like is that the chat be visible but that the entry not be available unless logged in.

    Plugin Author Jeff Starr

    (@specialk)

    Did you take a look at the next setting, “Display Mode”? It’s like the 4th option on the SAC settings page. When enabled, it displays chat messages as read-only. So visitors can view chats, but not add their own.

    Thread Starter Larry Lewis

    (@jenolan)

    Yes .. it says you need to be logged in to access chat, that is with ‘Require users to be logged in to view and use the chat box.’ on and ‘Display chat messages as read-only. So visitors can view chats, but not add their own.’ on

    Thread Starter Larry Lewis

    (@jenolan)

    ok need to have the logon option set to off, but now the username is not hidden 😉

    • This reply was modified 1 year, 4 months ago by Larry Lewis.
    Plugin Author Jeff Starr

    (@specialk)

    The username *field* or the usernames displayed in the chat box?

    Thread Starter Larry Lewis

    (@jenolan)

    I have modded the output to suit .. no worries

    Plugin Author Jeff Starr

    (@specialk)

    That is great, glad you got it sorted.

    For anyone else reading, and just for clarity, here is how it works:

    When “Display Mode” is enabled (and “Require log in” is disabled), the chat Name, URL, and Message fields will not be displayed to regular, non-logged-in visitors. Only the chat box will be visible. Then for logged-in users, the chat box is displayed along with the Name, URL, and Message fields.

    Either way, whether the user is logged in or not, the chat box always displays the chat name along with each chat message. If you do not want to display the chat names, you can hide them on the page (but not in the source code) by adding the following CSS:

    .sac-chat-name { display: none; }

    That code can be added via the SAC setting, “Custom CSS styles”. Or it can be added via your theme, child theme, etc. Lots of ways to add custom CSS with WordPress.

    Thread Starter Larry Lewis

    (@jenolan)

    Backed off my code mod, added the css didn’t work, should be

    #sac-user-info { display: none; }

    Plugin Author Jeff Starr

    (@specialk)

    No actually that is for the Username field. There is a difference between the Username field and the usernames displayed next to messages in the chat box. As explained in my previous post, the Username field (e.g., #sac-user-info) should not be displayed given the following settings:

    * Display Mode – Enabled
    * Require log in – Disabled

    With that configuration, the Username field is not displayed. Neither is the URL or Message fields displayed. Only the chat box is displayed. So there is no reason to add any CSS to hide the Username, URL, or Message fields. I hope this is clear.

    If that is not the case, and the Username field is displayed when you have the above settings configuration, then something is wrong, like a bug or conflict or whatever.

    Normal functionality hides the Username field given above stated config.

    Thread Starter Larry Lewis

    (@jenolan)

    Ummm … the code says;

    <?php if ($use_username && !empty($logged_username)) : ?>

    Which if I am reading it right says if the setting ‘use_username’ is ON and the user is logged in then it shows the ‘Name: {name}’ there is no further ‘if’ to not display, the emit code follows immediately.

    Plugin Author Jeff Starr

    (@specialk)

    No that logic determines only which markup to use to display the Username field. Notice the else condition displays the Username field as well, only using different markup.

    Further, the if condition you refer to is nested within another if condition:

    if (!$read_only || ($read_only && current_user_can('read'))) :

    Such that the entire input panel (Username, URL, and Message fields) is not displayed when the above described conditions are met.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘View only allowed if Require users to be logged in set’ is closed to new replies.