Primary

[groups_login]

The [groups_login] shortcode renders a login form, where the user can input the username and password to log in.

Here it is in its most simple form placed on a page as seen from the visual editor:

The form will appear if the visitor is not logged in.

The [groups_login] shortcode rendered, presenting a form where the user can input the username and password to log in.

This shortcode allows the use of the following optional attributes:

  • redirect defaults to the current URL and will redirect to the given page after successful login.
    If you place the shortcode on a certain page and omit this parameter, a successful login will bring the user back to the same page where the login form is placed. If login fails due to a wrong username or password provided, the user will be taken to the standard WordPress login and once successfully authenticated, will be brought back to the page where the login form is placed.
    If a URL is provided, the user will be redirected there after a successful login.
  • show_logout defaults to "no" and if set to "yes" will present a logout link in place of the login form when the user is logged in.
    This can be used instead of the [groups_logout] shortcode if desired.

Here is a more complex example. You can place this snippet on a new page and view it first while logged in and then while logged out to see it as a normal visitor. The first section will show a text to those who are not logged in along with the login form. The second section would show some supposed links you could place there for members of a Premium group. The third section shows the link to log out.

[groups_non_member group="Registered"]
Please log in to access our VIP sections:
[groups_login]
[/groups_non_member]

[groups_member group="Premium"]
Thanks for being a part of our community.
You have privileged access to these pages:

- Link 1
- Link 2
- ...
[/groups_member]

[groups_logout]