Form Shortcodes

Shortcodes are available directly in the post editor window from the item in the toolbar menu: [ wp-members ]

wpmem_form

This shortcode can display various WP-Members forms by adding the following tags:

  • login – the main body login form
  • register – the registration form
  • password – forgot password reset and password change (dependent upon user login state)
  • user_edit – user profile edit
  • redirect_to – accepts a url to redirect to upon successful form action (login|register forms only).

For example, to display a login form, the shortcode would be as follows:

[wpmem_form login /]

The login and register forms each have a default logged in state that displays some bullet links. These links can be customized with the wpmem_login_links_argswpmem_login_link, wpmem_register_links_args, and wpmem_register_links filters.  You can override the default logged in state with your own content by nesting it in the shortcode as follows:

[wpmem_form login]
This only displays to a logged in user.
You are logged in as: [wpmem_field field=user_login]
[wpmem_logout]
[/wpmem_form]

Anything nested between the [wpmem_form] tags will be what shows to the logged in user.

Both the login and register forms also accept a redirect_to parameter.  This allows you to manually set a page that the form will redirect to upon successful submission.  (Note that this can also be done with the wpmem_login_redirect and wpmem_register_redirect filters.)

Note: if you are considering a redirect, carefully consider whether it is truly necessary.  The plugin already has a default flow that is designed to offer a smooth user experience.

Here is an example of a login form that will redirect the user to a specific page after successfully logging in:

[wpmem_form login redirect_to="http://mysite.com/my-special-page" /]

Note that the user_edit parameter should only be displayed to users who are logged in.  You can do this by nesting it in the logged in shortcode. Here is an example:

[wpmem_logged_in]
[wpmem_form user_edit]
[/wpmem_logged_in]
[wpmem_logged_out]
Log in to edit your profile[wpmem_form login]
[/wpmem_logged_out]