Overview
The Login extension provides several options to embed a login form on your site so users can easily log in to their user accounts. These options include a highly customizable sidebar widget, a content block, and a shortcode.
Installation
- Navigate to the Add New sub-page under the Plugins admin page.
- Search for
connections business directory login. - The plugin should be listed first in the search results.
- Click the Install Now link.
- Click the Activate Plugin link to activate the plugin.
Widget
To add the widget to the theme’s sidebar, navigate to the Widgets admin page and find the Connections : Login Form widget. Click the widget and select the sidebar to which you wish to add the widget. Alternatively, you can click, drag, and drop the widget to the sidebar where you want to add the widget. The widget settings are separated into sections to make configuring the widget easy and intuitive.
Common Settings
Presently, there is only a single setting in this section. The option is to choose whether or not to display the widget only on the single entry detail/profile page. The option is off by default, but if enabled, it will only allow the widget to show when the user is on the entry detail/profile page.
User Logged-out Settings
This section of settings allows you to configure the widget’s display options when being viewed by a user who is not yet logged into your site. The available options are:
Title :: This is the widget’s name when displayed on the site frontend, in the theme’s sidebar.
Display the “Remember me” checkbox? :: Whether or not to display the Remember me checkbox. This is off by default.
Display the “Lost Password” link? :: Whether or not to display the Lost Password link. This is off by default.
Custom Links :: This section allows you to add your custom links. The format to add your link is Text | URL. The Text will be the link text, and the URL will be the web address of the link being added. The Text and URL must be separated by a pipe ( | ).
Tip
The pipe is usually found above the Enter key on a standard keyboard.
Tip
You can add as many custom links as you wish by adding a new line for each link you want to add.
User Logged-in Settings
This section of settings allows you to configure the widget’s display options when viewed by a user logged into your site. The available options are:
Title :: This is the widget’s name when displayed on the site frontend, in the theme’s sidebar.
Tip
This field supports Tokens.
Show Image :: Choose to display the logged-in user’s Gravatar. The default is not to display an image.
Tip
If you have the Link extension installed, you will also have the entry’s photo or logo as options in addition to the user’s Gravatar.
Image Size :: Set the size of the image to be displayed. The default is 38px.
Display the user profile link? :: Whether or not to display the link to the user’s admin profile page. The default is to show the link.
Display the logout link? :: Whether or not to display the logout link. The default is to show the link.
Custom Links :: This section allows you to add your custom links. The format to add your link is Text | URL | Capability. The Text will be the link text. The URL will be the web address of the link being added. The Text,URL and Capability must each be separated by a pipe ( | ). The Capability is optional and refers to the capability the user must have for the link to be visible to the user.
Tip
The pipe is usually found above the Enter key on a standard keyboard.
Tip
You can add as many custom links as you wish by adding a new line for each link you want to add.
Tokens
When customizing the widget title for a logged-in user, you can use several available tokens to personalize it. What are tokens? They are unique strings that will be replaced with dynamic text. For example, you could use Welcome, %username% or Howdy, %name% for the widget title to display the user name or greet the user by name, respectively.
The available tokens that can be used in the widget title are the following.
%username%:: This is the user’s name.%userid%:: This is the user’s ID number.%firstname%:: This is the user’s first name.%lastname%:: This is the user’s last name.%nickname%:: This is the user’s nickname.%display_name%:: This is the display name the user chooses on their admin profile page.%name%:: This is the user’s first and last name separated by a space.
Just as there are tokens that can be used in the widget title field, there are tokens that can be used in the Custom Links for the URL. The available URL tokens are the following:
%admin_url%:: This is the URL for the admin.%logout_url%:: This is the logout URL.%profile_url%:: This is the user’s admin profile page URL.
Login also supports both bbPress and BuddyPress and provides several more URL tokens that can be utilized when either of those plugins are installed and activated.
The available URL tokens for bbPress are the following.
%bbpress_profile_url%:: This is the URL for the user’s bbPress profile page.%bbpress_topics_created_url%:: This is the URL for the forum topics started by the user.%bbpress_replies_created_url%:: This is the URL for the forum replies to topics submitted by the user.%bbpress_favorites_url%:: This is the URL for the topics that the user favorited.%bbpress_subscriptions_url%:: This is the URL for the topics to which the user is subscribed.
The available URL tokens for BuddyPress are the following.
%buddypress_profile_url%:: This is the URL for the user’s BuddyPress profile page.
Tip
You can also use the widget title field tokens in the Custom Links field.
Content Block
The content block can be enabled on the Settings admin page under the display tab. You can optionally display the login form in the Results List view or the Single Entry detail/profile view.
Tip
It is recommended that if you choose to display the login form content block, you only enable it in the Single Entry detail/profile view.
Important
Not all templates support displaying content blocks in the Results list view.
Shortcodes
Tip
It is highly recommended you take a moment to read the Working with Shortcode: The Basics if you are not familiar with shortcodes and how to use them.
Tip
The shortcode can be used in any place where shortcodes are supported in WordPress.
[connections_login]
The [connections_login] shortcode is ideally suited to be used in the require login message if you need users to be logged in to view the directory.
Options
redirect:: An address to redirect to after a successful login. This must be an absolute URL, as in “https://example.com/mypage/”. The default is to redirect to the current page.label_username:: Label for the username field. The default is Username.label_password:: Label for the password field. The default is Password.label_remember:: Label for the remember field. The default is Remember Me.label_log_in:: Label for the submit button. The default is Log In.remember:: Whether to display the “Remember me” checkbox in the form. The default is to show the checkbox.
[user_]
This shortcode can be used to display various details from the user profile.
Important
Notice the trailing underscore in the shortcode name; this is intentional. You must use the trailing underscore in the shortcode tag because shortcode tags must be unique, and the trailing underscore makes it unique while keeping the shortcode tag short and easily identifiable.





Options
prop:: The user property to display. Default isid.- Valid options:
avatar,avatar_url,bio,display_name,email,first_name,id,last_name,login,nice_name,meta,registered,website
- Valid options:
id:: The useridto display data. Default is the current logged-in userid.meta:: Themeta_keyname to display its value. This option is valid only when used with themetaprop.size:: The image size of the user avatar. This value is in pixels. The default value is96. This option is only valid when with either theavataroravatar_urlprop.
Examples
Current logged-in user details Classic Editor example:
[user_ prop='avatar' size=300] ID: [user_ prop='id'] Login: [user_ prop='login'] Nice Name: [user_ prop='nice_name'] Display Name: [user_ prop='display_name'] First Name: [user_ prop='first_name'] Last Name: [user_ prop='last_name'] Email: [user_ prop='email'] Website: [user_ prop='website'] Registered On: [user_ prop='registered'] Meta – User Level: [user_ prop='meta' key='wp_user_level'] Bio [user_ prop='bio']
Advanced current logged-in user example:
[user_ prop='first_name']Hello, %s[/user_]
The above example will render “Hello, {first name}” only if the current user is logged in. Whereas the previous example will render “First Name: {first name}” where {first name} would be blank if the user was not logged in.
Important
If using both enclosing and self-closing instances of this shortcode on the same page, make sure to add a trailing forward slash (/) to the self-closing instances of the shortcode. Example: [user_ prop='bio'/]
Download and import this Block Editor Pattern for a complete example of the [user_] shortcode.
Important
To download the example pattern, right-click the download button and choose the “Save Link As…” option.
[link_]
Introduced in version 3.2, this shortcode allows you to output a login, logout, edit profile, registration, forgot password, or a dynamic login/logout link on a page.
Important
Notice the trailing underscore in the shortcode name; this is intentional. You must use the trailing underscore in the shortcode tag because shortcode tags must be unique, and the trailing underscore makes it unique while keeping the shortcode tag short and easily identifiable.
Options
action:: The link action. Default islog_in|out.- Valid options are:
log_in,log_out,profile,registration,reset_password, andlog_in|out.
- Valid options are:
redirect:: The is the redirect URL parameter added to the login, logout, and reset password links.text:: Set the link text.
Examples
To display a dynamic login/logout link, utilize the following shortcode. This shortcode outputs the link text “Log In” when the site visitor is not logged in. If the site visitor is logged in, the link text will be “Log Out” instead.
[link_]
The default text for both can be changed using the text shortcode option. The following example shows that the login and logout text can be changed. Add the text for both user states separated by the pipe character.
[link_ text='Login|Logout']
Display a link to the logged-in user’s profile page. The default text is “Edit Profile” and can be changed using the text shortcode option. If the user is not logged in, nothing will be displayed.
[link_ action='profile'] [link_ action='profile' text='Edit My Profile']
Similar to the above examples, you can also display the link to the user registration and reset password pages. The default link text for the registration link is “Register” and the default link text for the reset password link is “Reset Password”. The default link text can also be changed by using the text shortcode option.
[link_ action='registration'] [link_ action='reset_password']



