Profile Builder Shortcodes

Shortcodes List

Profile Builder comes with a set of shortcodes you can use right away:

  • [wppb-register] – Displays the Front End Registration Form
  • [wppb-login] – Displays the Front End Login form
  • [wppb-logout] – Displays the Front End Logout Text and Link
  • [wppb-edit-profile] – Displays the Front End Edit Profile Form
  • [wppb-recover-password] – Adds a Front End Recover Password Form
  • [wppb-restrict] – Restrict Content shortcode

Available only in Profile Builder Pro:

  • [wppb-list-users] – Displays the Front End User Listing. This shortcode will work only in the PRO version, when the the User Listing module is activated
Shortcodes work only on pages created by users with administrator capabilities. This is to prevent users who can post but are not admins, from creating shortcodes that register administrators, thus gaining full access to the site

Create a Front End Registration Form

In order to generate the Registration form follow the steps below:

  • Create a new page and name it appropriately, for example Register or something similar
  • Add the [wppb-register] shortcode inside using the Text Editor (not Visual)
  • Hit publish and go to the page to see your form

Profile Builder Pro - Shortcodes - Registration Form

Front End Registration Form

Profile Builder Pro - Shortcodes - Registration Form Front End

In order to customize the registration form you need to go to Profile Builder -> Manage Fields

Allow users to register via Profile Builder on Multi Site

In order to let users to register on your Multi Site you must enable the “User accounts may register” option.

For this, in the WordPress Admin Interface, logged in as Super Admin go to My Sites -> Network Admin -> Settings -> Network Settings tab and under “Allow new registrations” make sure to check User accounts may be registered. Save changes and your Multi Site will now allow User Registration.

Profile Builder Pro - Shortcodes - User accounts may be registered

Register users with a specific role

By default users receive, after Registration, the User Role set in Settings -> General -> New User Default Role.

You can assign a specific User Role (example: Editor, Author, Subscriber etc.) to users on Registration by using the role argument inside the Registration shortcode:

[wppb-register role="editor"]

The role argument, from the shortcode, must use a valid (existing) User Role else the Role will revert back to the Default WordPress User Role (Subscriber) for security reasons.

Automatically log users in after Registration

You can use the automatic_login argument with the ‘yes’ or ‘no’ options to determine if users should be automatically logged in after they complete the registration form.

[wppb-register automatic_login="yes"]

Please note that this option can be set in a few other places and will be applied with the following priority: Shortcode -> Multiple Registration Forms individual form settings -> General Settings.

Redirect users after Registration

Profile Builder makes it really easy to redirect users after registration to any URL by using the redirect_url argument:
1
[wppb-register redirect_url="http://www.yourdomain.com/page"]

The redirect will NOT work if it’s pointing to an outside URL, it needs to point to a page on your site.

Redirect users after Logout

Logged in users that access the Register page, where we added the [wppb-register] shortcode, will see a notification:

Profile Builder Pro - Shortcodes - Registration Form Front End for Logged In Users

To redirect the user after clicking on the Logout link we will need to use the logout_redirect_url argument:

[wppb-register logout_redirect_url="http://www.yourdomain.com/page"]

Register users in Front End as Admin

As Admin you can register users in Front End if you go to the Registration form created with the [wppb-register] shortcode.

Profile Builder Pro - Shortcodes - Registration Form Front End Admin

Create a Front End Login Form

In order to generate the Login form follow the steps below:

  • Create a new page and name it appropriately, for example Login or something similar
  • Add the [wppb-login] shortcode inside using the Text Editor (not Visual)
  • Hit publish and you’ll be prompted with a Login form in the Front End

Profile Builder Pro - Shortcodes - Login Form

Front End Login Form

Profile Builder Pro - Shortcodes - Login Form Front End

Redirect users after Login

Profile Builder makes it really easy to redirect users after login to any URL by using the redirect_url argument:

[wppb-login redirect_url="http://www.yourdomain.com/page"]

The redirect will NOT work if it’s pointing to an outside URL, it needs to point to a page on your site

Redirect users after Logout

Logged in users that access the Login page, where we added the [wppb-login] shortcode, will see a notification:

Profile Builder Pro - Shortcodes - Login Form Front End for Logged In Users

To redirect the user after clicking on the Logout link we will need to use the logout_redirect_url argument:

[wppb-login logout_redirect_url="http://www.yourdomain.com/page"]

Add Register and Lost Password? links below the Login form

You can add a Register and a Lost your password? link below the Login form using the register_url and lostpassword_url arguments:

[wppb-login register_url="/register" lostpassword_url="/recover-password"]

Front End Login Form

Profile Builder Pro - Shortcodes - Login Form Front End Links

Create a Front End Logout Text / Link

The [wppb-logout] shortcode allows you to display a Logout Text and Link in the Front End. It also allows you to redirect your users after they log out.

You can use one or more of the available arguments:

  • text – The intro text where you can use one of the following available tags: {{meta_user_name}}, {{meta_first_name}}, {{meta_last_name}}, {{meta_display_name}}
  • redirect_url – The desired link, from your own website, where to redirect the user after Log out (defaults to current page)
  • link_text – The text for the Log out link
  • url_only – Setting this to “yes” allows you to output the redirect URL only

Example:

[wppb-logout text="You are currently logged in as {{meta_user_name}}. " redirect_url="http://www.yourdomain.com/page" link_text="Log out »"]
The logout shortcode requires at least Profile Builder v2.0.9 or higher

Profile Builder Pro - Shortcodes - Logout Front End
For outputting the redirect URL only:

[wppb-logout redirect_url="http://www.yourdomain.com/page" url_only="yes"]

Create a Front End Edit Profile Form

In order to generate the Edit Profile form follow the steps below:

  • Create a new page and name it appropriately, for example Edit Profile or something similar
  • Add the [wppb-edit-profile] shortcode inside using the Text Editor (not Visual)
  • Hit publish and you’ll be prompted with a Edit Profile form in the Front End

Profile Builder Pro - Shortcodes - Edit Profile Form

Front End Edit Profile Form

Profile Builder Pro - Shortcodes - Edit Profile Form Front End

Redirect users after Editing their Profile

Profile Builder makes it really easy to redirect users after they edit their profile to any URL by using the redirect_url argument:

[wppb-edit-profile redirect_url="http://www.yourdomain.com/page"]

The redirect will NOT work if it’s pointing to an outside URL, it needs to point to a page on your site

Edit user profile in Front End as Admin

As Admin you can Edit User Profiles in Front End if you go to the Edit Profile form created with the [wppb-edit-profile] shortcode.

You will see a Select drop-down field called “User to edit” that you can use to select any user and edit their profile.

Profile Builder Pro - Shortcodes - Edit Profile Form Front End Admin

Create a Recover Password Form

In order to generate the Recover Password form follow the steps below:

  • Create a new page and name it appropriately, for example Recover Password or something similar
  • Add the [wppb-recover-password] shortcode inside using the Text Editor (not Visual)
  • Hit publish and you’ll be prompted with a Recover Password form in the Front End

Profile Builder Pro - Shortcodes - Recover Password Form

Front End Recover Password Form

Profile Builder Pro - Shortcodes - Recover Password Form Front End

After inserting the Username or Email inside the field and pressing the “Get New Password” button the user will receive an Email Notification.

Profile Builder Pro - Shortcodes - Recover Password Form Submit

To reset the password the user will need to click on the reset link displayed inside the Email Notification.

Profile Builder Pro - Shortcodes - Recover Password Form Email Notification

After clicking on the reset link the user will go to the Recover Password form where he can reset the password.

Profile Builder Pro - Shortcodes - Reset Password Form Front End

Successful reset

After a successful reset the user and also the Admin are notified, via an Email Notification, about the password reset.

Profile Builder Pro - Shortcodes - Reset Password Form Front End Success

Error when resetting the password

If the passwords don’t match an error will be triggered.

Profile Builder Pro - Shortcodes - Reset Password Form Front End Error

Restrict Content

This shortcode can be used within your content to restrict certain parts and make them display only for logged in/out users or only for certain user roles.
To use it, you need to wrap the content between the opening and closing tags of the shortcode:

1
2
3
[wppb-restrict]
Aenean quis arcu eleifend, tincidunt ligula quis, laoreet lectus.
[/wppb-restrict]

Everything that’s encapsulated between the two tags will be restricted for the logged out user, so only Logged in Users will be able to view it.

This shortcode will not work if the Content Restriction feature is disabled inside Profile Builder.

Parameters

1
[wppb-restrict user_roles="" display_to="" message=""]content[/wppb-restrict]
  • user_roles – A comma separated list of User Role slugs that should have access to the content. If this is not set, all logged in users will see the restricted content.
  • display_to – Can take the value of `not_logged_in` to display the content only to Logged Out Users
  • message – If specified, this will overwrite the message that is shown to users that do not have access to the Restricted Content
Administrators by default aren’t restricted and see all the content. If the display_to parameter is equal to not_logged_in, Administrators will also see that content.

Restrict Content based on User Roles

To restrict the content based on one or more User Roles, we will need to specify the user_roles parameter:

1
2
3
[wppb-restrict user_roles="editor, author"]
Aenean quis arcu eleifend, tincidunt ligula quis, laoreet lectus.
[/wppb-restrict]

In the example from above, the content will be shown only to Editors and Authors.

Modify the message that is displayed to the user

To modify the message shown to users who do not have access to this content, we will need to add the message parameter:

1
2
3
[wppb-restrict message='You must be logged in to view this content.<a href="/login">Login</a>']
Aenean quis arcu eleifend, tincidunt ligula quis, laoreet lectus.
[/wppb-restrict]

When you specify this parameter, the default message that is setup in Profile Builder -> Content Restriction will be overwritten.

Display content only to logged out users

For this to work we need to add the display_to parameter with the not_logged_in value to the restriction shortcode:

1
2
3
[wppb-restrict display_to="not_logged_in" message=" "]
Aenean quis arcu eleifend, tincidunt ligula quis, laoreet lectus.
[/wppb-restrict]

In the example, I am also specifying the empty message parameter so we don’t show the Content Restriction message to logged in users.

Create a Front End User Listing

The User Listing module is available only in Profile Builder Pro. You will have to enable this module in order for the User Listing shortcode to work.

In order to generate the User Listing follow the steps below:

  • Create a new page and name it appropriately, for example User Listing or something similar
  • Add the [wppb-list-users name="member-directory"] shortcode inside using the Text Editor (not Visual)
  • The value “member-directory” from the name argument is generated automatically based on the User Listing title
  • Hit publish and you’ll be prompted with a User Listing in the Front End

Profile Builder Pro - Shortcodes - User Listing

Front End User Listing

Profile Builder - User Listing - Search All Fields

The User Listing module offers many options to customize and control the listing of your users. Make sure to check out the User Listing documentation page.

You can use one or more of the available arguments:

  • meta_key=”key_here” – We need to set the meta name of the field
  • meta_value=”value_here” – Displays users having a certain meta-value within a certain (extra) meta-field
  • include=”user_id_1, user_id_2″ – Displays only the users that you specified the user_id for
  • exclude=”user_id_1, user_id_2″ – Displays all users except the ones you specified the user_id for
[wppb-list-users name="member-directory" meta_key="custom_field_1" meta_value="value"] 
[wppb-list-users include="user_id_1, user_id_2"] 
[wppb-list-users exclude="user_id_1, user_id_2"] 

Remember though, that the field-value combination must exist in the database.

List users with a certain meta_key and meta_value combination

You can list only the users with a certain Extra Field Meta Name (example: “car”) and value (example: “family”) combination by using the following shortcode:

[wppb-list-users meta_key="car" meta_value="family"]

This way the user listing will contain only the users which own a family car.

If you want to use this method with a checkbox, you need to put a trailing comma after the meta_value value

Example:

[wppb-list-users name="member-directory" meta_key="custom_field_1" meta_value="value1,value2"]

Include or exclude users from a list

There are certain situations where you would like to display only a handful of users. You can do this with the following shortcode:

[wppb-list-users include="1,2,3,4"]

The numbers in the include attribute are the IDs of the users you wish to display.

You can also exclude users from certain lists. With the shortcode:

[wppb-list-users exclude="5,6"]

All users will be displayed, with the exception of the users with the IDs 5 and 6.

Display Single User-Profile using shortcode

You might want to display a specific user profile on a page, post or widget. This is possible using the following shortcode:

[wppb-list-users single id="1" name="userlisting"]

Where id contains the id of the user which you want to display the profile for and name specifies which Userlisting template to use.
If the name parameter is not specified, it will display it using the default template.

You can also not specify the id argument to display the profile of the current logged in user:

[wppb-list-users single name="userlisting"]

Profile Builder Pro

Create beautiful front-end registration and profile forms with custom fields. Setup member directories, custom redirects, cutomize user emails & more using the all in one user management plugin.

Unlock PRO Features

Or download FREE version