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

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 you’ll be prompted with a Registration form in the Front End

Profile Builder Pro - Shortcodes - Registration Form

Front End Registration Form

Profile Builder Pro - Shortcodes - Registration Form Front End

Allow users to register via Profile Builder

In order to let users to register on your website you must enable the “Anyone can register” option.

For this, in the WordPress Admin Interface, go to the Settings -> General tab and under Membership make sure to check Anyone can register. Save changes and your website will now allow User Registration.

Profile Builder Pro - Shortcodes - Membership

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.

Example: [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.

Redirect users after Registration

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

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

Note – 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:

Example – “You are currently logged in as johndoe. You don’t need another account. Logout »”

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:

Example: [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:

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

Note – 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:

Example – “You are currently logged in as johndoe. Log out »”

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:

Example: [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:

Example:

[wppb-login register_url="http://www.yourdomain.com/register" lostpassword_url="http://www.yourdomain.com/recover-password"]

Front End Login Form

Profile Builder Pro - Shortcodes - Login Form Front End Links

Create a Front End Log out 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

Example:

[wppb-logout text="You are currently logged in as {{meta_user_name}}. " redirect_url="http://www.yourdomain.com/page" link_text="Log out »"]

Note – The logout shortcode requires at least Profile Builder v2.0.9 or higher

Profile Builder Pro - Shortcodes - Logout Front End

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:

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

Note – 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 E-mail inside the field and pressing the “Get New Password” button the user will receive an E-mail 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 E-mail 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 E-mail 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

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:

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

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

Note – 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:

Example: [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: 

Example: [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:

Example: [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:

Example: [wppb-list-users single]