Simple Ajax Chat Pro (SAC Pro) makes it possible to set up private chats between users. When enabled, private chats enable direct communication between selected users only; no other users or visitors will have access to the chat. With SAC Pro, you can create and display any number of private (or public) chat forms on the front end of your WordPress-powered site. This tutorial shows how to set it up, along with a usage example and some important notes.
Enable Private Chat
To create a private chat form, get the usernames that are invited (allowed) to chat. Then add the
private_chat attribute to the
[sacpro] shortcode. Here is an example where we invite four users to participate in the chat:
[sacpro form_id="123" private_chat="WordPress User, Batman, Guest_02050, ladiesman217"]
Add your list of user names as the value of the
private_chat attribute, as shown in the example above. Separate multiple user names with a comma. After saving changes, any user included in the
private_chat attribute can access the private chat simply by visiting the page.
More attributes to customize your chat forms can be found in the SAC Pro shortcode reference.
For example, if we add a private chat to a page located at:
Now we can invite allowed users to join the chat by visiting that link. Invited users will have open access to the chat. Uninvited visitors will not have access, and will get a message that says:
Private chat (access not allowed).
Note: Private chat users may need to log in to WordPress in order to access private chats. This is because SAC Pro automatically uses registered user names when available. Learn more about chat user names.
Note: When testing, understand that SAC Pro handles user names at the browser level. So that means you can’t be two different users in the same browser. To test your chat form with multiple users, use a different browser for each user.
private_chat attribute also accepts
false to disable the private and make it a public chat. The same result happens if you simply remove the
private_chat attribute from the shortcode. In other words, the default state of any chat form is public.
Note: Be careful if changing from private to public chat. Best practice is to visit the SAC Pro settings ▸ Manage, and delete all private messages before changing a chat form to public. Even better, instead of changing from private to public, delete the private shortcode AND database table, and then just start fresh with a new public form. The goal here is to keep private chat information secure. Be mindful with your chat data.