This video covers the advanced shortcodes for the Front-End Only Users plugin, that can be used to display a user’s profile, search through users, display a list of users or display a piece of a user’s data. Before watching this video, you should have already set up the fields your users will be filling in and have created the pages for your users to register, login, etc. If you need guidance on either of those tasks, please take a look at the first two videos in this tutorial series.
To begin with, we’re going to create a user profile page using the [user-profile] shortcode. This shortcode is used to display a dingle user’s profile, based on the data passed to it. It is often used in conjunction with the list and search shortcodes to make all of your users’ profiles searchable. The attributes that can be added to this shortcode are “login_page”, which specifies the URL of the login page for your site, “omit_fields”, which tells the plugin which fields shouldn’t be displayed when using this shortcode, and “login_necessary”, which forces visitors to login before they’re able to view a profile when set to “Yes”.
Next, let’s insert a search form so that we can find some users, based on one or more criteria. The search form is created using the [user-search] shortcode, and it requires the “search_fields” attribute to be included. This attribute takes a comma-separated list of fields which visitors should be able to search through. We’re going to use “Gender,First Name” in our example. Adding these criteria gives us a search form that looks like this. The other attribute we’re going to add is optional, but adds a lot of functionality to the [user-search] shortcode. It is “user_profile_page”, which specifies the URL where the [user-profile] shortcode is located. By including this attribute, we make it possible for visitors to search and view other users’ profiles.
The [user-list] shortcode allows you to display a list of all site members, or a subset of your site’s members that meet a specific criteria. You can use the “field_name” and “field_value” attributes to select the subset of users you’d like to display. Again, you can use the “user_profile_page” attribute to specify the page where the [user-profile] shortcode is located, to greatly enhance the functionality of your user list.
Finally, the [user-data] shortcode can be used to personalize your site for logged in visitors. This shortcode can be used to display a piece of a user’s data in a specific location. The attribute required for this shortcode is “field_name”, which is the name of the field that you want to display. There’s also the “plain_text” attribute, which makes the shortcode return the piece of user data inside of some HTML code when set to “No”. This shortcode can be used in a lot of ways, but a simple example is [user-data field_name=’First Name’]. This could be used to display a personalized welcome message like the one below when a user logs back in to your site.