Log In/Out Shortcode
  • Home
  • Log In/Out Shortcode

Log In/Out Shortcode

If-So allows you to easily create a custom login/logout experience using a simple shortcode. The shortcode includes options to change the text on the Log In and Log Out links, and even to choose the page to which users will be redirected after logging in.

To provide a complete experience, you can also use If-So to populate the user name (or other details). For example, if the user is logged in, you can add the user name to the logout message:

Hi {name}, log out

How to show a login/logout link using a shortcode

Display a login/logout link:

[ifso_login_link] 

When the user is logged out, the shortcode will populate a login link with the text “Log In”. When the user is logged in, the shortcode will populate a logout link with the text “Log Out”.

Redirecting users to a chosen page after successful login

By default, the If-So login shortcode redirects users back to the page on which they clicked the log-in button. If you want to redirect users to another page after logging in simply add the parameter login_redirect=”https://yourpage.com” to the shortcode.

[ifso_login_link login_redirect="https://example.com/account"] 

The shortcode above will redirect users to the page “https://example.com/account” after a successful login. Removing the redirect parameter will send users back to the last page they visited before clicking the login link.

Changing the text of the login and logout links

Add the parameters login_text=”value you choose” and logout_text=” value you choose” to change the link text.

[ifso_login_link login_text="Sign In" logout_text="Sign Out"] 

The shortcode above will populate a login and logout link with the text “Sign In” and “Sign Out”.

How to display the user’s name (or other user’s details) – For logged-in users

If-So allows you to display the user’s first name, last name, and email using a shortcode. Click here to learn more.

Ready to get started?
Try it on your website

Halloween Sale

65% Off!

Learn more →