Simple Ajax Chat Pro (SAC Pro) provides fine-grained control over user names. For example, you can enable users to choose their own chat names. Or you can choose to generate random usernames. For logged-in users, you can even use registered usernames as chat names. This tutorial explains the default options for user names, and shows how to customize the options for any SAC Pro chat forms.
User name
The User Name option determines how SAC Pro handles user names. You can choose to let the user enter their own chat name. Or you can automatically generate “guest” names. For logged-in users, you can use the registered login name, nice name, nick name, display name, or first and last name.
To set the default (global) option for user name, visit the SAC Pro settings ▸ General ▸ “User Name”.
To set the user name for a specific form, add the user_name
attribute to the [sacpro]
shortcode:
[sacpro form_id="123" user_name="user_defined"]
Possible values for the user_name
attribute:
- user_defined — lets the user enter their own name
- auto_gen — automatically generates a random name (related: change name prefix)
- user_login — use the registered user’s login username (requires user to be logged in)
- nice_name — use the registered user’s Nice Name (requires user to be logged in)
- first_last — use the registered user’s First & Last name (requires user to be logged in)
- nick_name — use the registered user’s Nickname (requires user to be logged in)
- display_name — use the registered user’s Display Name (requires user to be logged in)
More attributes to customize your chat forms can be found in the SAC Pro shortcode reference.
Change the name prefix
When auto_gen
is selected for the user name, chat names will be five random numbers prefixed with guest_
. So for example here are some possible auto-generated names:
- guest_12345
- guest_60585
- guest_78130
To set the default (global) guest name prefix, visit the SAC Pro settings ▸ General ▸ “Guest Name Prefix”.
To set the name prefix for a specific form, add the name_prefix
attribute to the [sacpro]
shortcode:
[sacpro form_id="123" user_name="auto_gen" name_prefix="user_"]
The name_prefix
attribute accepts any alphanumeric characters, underscores and hyphens.
More attributes to customize your chat forms can be found in the SAC Pro shortcode reference.
Notes on user names
If the user is logged in, their registered user information always will be used for their chat name, regardless of settings. If the user is not logged in, the user name will be randomly generated OR it will be defined by the user. That’s a bit abstract, so here are some tables to help sort it out.
When the user is logged in
Value of user_name |
Displayed chat name |
---|---|
user_login , user_defined , auto_gen |
Registered Login Username |
nice_name |
Registered User Nicename |
first_last |
Registered First and Last Name |
nick_name |
Registered User Nickname |
display_name |
Registered User Display Name |
When the user is NOT logged in
Value of user_name |
Displayed chat name |
---|---|
user_login , nice_name , first_last , nick_name , display_name , auto_gen |
Generated random username (e.g., guest_12345) |
user_defined |
User defines their own name |