Simple Ajax Chat Pro (SAC Pro) chat forms can be public, private, read-only, or “require login”. When user login is required, the chat box is not displayed unless the user is logged into WordPress. This tutorial shows how to require user login for any or all chat forms. Also shows how to customize the message that’s displayed to non-logged users.

Tip: Just getting started with SAC Pro? Check out the Quick Start Guide »

Require user login

To set the default (global) option, visit the SAC Pro settings ▸ General ▸ “Require Logged In”.

To set the welcome name for a specific form, add the logged_only attribute to the [sacpro] shortcode:

[sacpro form_id="123" logged_only="true"]

The logged_only attribute accepts either true or false.

More attributes to customize your chat forms can be found in the SAC Pro shortcode reference.

Customize the login-required message

When login is required and a non-logged user visits the form, a message is displayed that says, “You must be logged in to join this chat.”. You can change this message to say whatever you want.

To set the default (global) option, visit the SAC Pro settings ▸ General ▸ “Require Login Message”.

To set the welcome name for a specific form, add the logged_only_message attribute to the [sacpro] shortcode:

[sacpro form_id="123" logged_only="true" logged_only_message="Log in to join this amazing chat!"]

You can change the value of the logged_only_message attribute with any text or markup.

More attributes to customize your chat forms can be found in the SAC Pro shortcode reference.

Include basic markup

For the setting “Require Login Message” and the shortcode attribute logged_only_message, you can use %%login_url%% to display the URL of your site’s Login Page. To make it a link (instead of just plain text), add the following code:

{a href='%%login_url%%'}Log in{/a}

When that code is output on the front end, the curly brackets { } will be replaced by angle brackets < >. You can use this technique to include other HTML tags as needed. Read important note below.

Important: use only single (straight) quotes for any tag attributes (do not include any double quotes). For example, notice that we use straight single quotes when including href='%%login_url%%' in the read-only message. If we were to include double quotes or curly quotes, the shortcode syntax would be incorrect and things would not work correctly.