• Skip to primary navigation
  • Skip to main content

RocketGeek

Home of WP-Members, The Original WordPress Membership Plugin

  • WordPress Plugins
    • WP-Members
      • FAQs
      • Quick Start
      • Documentation
      • Extensions
    • Advanced Options
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Download Protect
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Invite Codes
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • MailChimp Integration
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • PayPal Subscriptions
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Salesforce Web-to-Lead
    • Security
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Text Editor
      • Purchase the Plugin
      • Get the Pro Bundle
    • User List
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • User Tracking
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Memberships for WooCommerce
    • WordPass
  • Blog
    • Basics
    • Tips and Tricks
    • Filters
    • Actions
    • Code Snippets
    • Shortcodes
    • Design
    • Release Announcements
  • Store
    • Cart
    • Checkout
  • Contact
  • Log In
  • Show Search
Hide Search
Home » Search for "short code"

Search Results for: short code

Login Status Shortcodes

The status shortcodes can be used to display content to users based on their login status.  There are two shortcodes:

  • Logged in content
  • Logged out content

Logged in content

The logged in shortcode is used for content that will display to a user that is logged in.  This can be used on any page, including special pages created with other shortcodes, such as the user profile area or a registration page.

Basic usage of the shortcode:

[wpmem_logged_in] This content can only be seen by logged in users. [/wpmem_logged_in]

Beyond the basic usage, the shortcode accepts the following attributes:

  • ID
  • role
  • meta_key/meta_value
  • product | membership

ID and Role attributes

The logged in shortcode can be used to display content only to specific user IDs or to specific roles.

The following example will display content only to a user whose ID is 123:

[wpmem_logged_in id=123]This content will only display to the user whose ID is 123[/wpmem_logged_in]

The following example will display content only to a user with the editor role:

[wpmem_logged_in role=editor]This content will only display to users with the editor role[/wpmem_logged_in]

Multiple IDs or roles can be specified when separated by commas.

This example would display only if the user has an ID of 123, 345, or 456:

[wpmem_logged_in id="123,345,456"]This appears to users with ID 123, 345, or 456[/wpmem_logged_in]

This would only display if the user has a role of “editor” OR “subscriber”:

[wpmem_logged_in role="editor,subscriber"]This content displays for editor role and subscriber role[/wpmem_logged_in]

Meta Key and Meta Value attributes

The logged in shortcode can also be used to display content to users who have a specific meta key/value. The attributes should be used as a pair as passing the key to check and the value is currently required.

For example, this would restrict content to users who have “the_value” as the value of “my_special_field”:

[wpmem_logged_in meta_key="my_special_field" meta_value="the_value"]This is restricted to users who have “the_value” as the value for “my_special_field”[/wpmem_logged_in]

If the meta key/value comparison needs to check if the value is “not equal” instead, you can use the “compare” attribute to check that the value is not equal – “!=”:

[wpmem_logged_in meta_key="my_special_field" meta_value="the_value" compare="!="]This is restricted to users who do not have “the_value” as the value for “my_special_field”[/wpmem_logged_in]

Membership attribute

For restricting content to user who have a specific membership enabled, you can specify the membership slug using either the “membership” attribute:

[wpmem_logged_in membership="my_membersip_product_slug"]This will display to users who have “my_membership_product_slug” access.[/wpmem_logged_in]

If you do not know the slug for the membership, go to Memberships > All Memberships and look in the “slug” column of the table for the membership you’re looking for.

Subscription content (PayPal extension only)

When used with the premium add-on module WP-Members PayPal Subscription extension it should first be noted that the basic logged in/out parameters are unaffected.  For example, if content is wrapped with the status shortcode for logged in status, the content will be viewable to a logged in user regardless of whether their subscription has expired or not.  The reason for this behavior is that some content may be necessary for a user to see when they are logged in, even if they are expired.

For subscription content that should be shown only if a user is logged in AND has a current (paid) subscription, the status shortcode will accept the “sub” attribute (for “subscription” or “subscribers only”).  This attribute can also accept a second optional parameter of “msg” to display a message that the content is based on subscription and the user is expired.  The “msg” attribute is a true/false boolean and defaults to false if not set.  A value of true will display the message, false will not.

[wpmem_logged_in status="sub" msg="true"]This is content for current subscribers only.  If the “msg” parameter is false or omitted, it will simply not display.  If “msg” is true, an expiration message will display in place of the protected content[/wpmem_logged_in]

Logged out content

The logged out shortcode displays content that will be shown to a user that is not logged in.  This can be used on any page, including special pages created with other shortcodes, such as the members settings area or a registration page.

[wpmem_logged_out] this content displays when a user is not logged in. [/wpmem_logged_out]

Email Shortcodes

The following is a list of shortcodes that may be used in the email messages.  Note: some shortcodes are only available in the admin message, and it is up to you to make sure that proper information is sent (i.e. if you remove [password] from the registration email, the user will not receive a password and thus not be able to login).  The plugin installs with defaults for each of these messages to provide you with an example of what is available.

  • [blogname] – the Site Title you have specified under Settings > General
  • [username]
  • [password]
  • [email] – the email address the user registered with
  • [reglink] – a link to the page the user registered on (useful to return a user directly to the content they registered to view)
  • [user-profile] – a link to the user profile where the user can update their password or registration information
  • [exp-type] – expiration type (subscription/trial) [available only if the PayPal Subscription Module is used]
  • [exp-date] – the expiration date [available only if the PayPal Subscription Module is used]
  • [login] – link to the login page if a login page is defined in the plugin’s main settings
  • [register] – link to the registration page if a registration page is defined in the plugin’s main settings
  • [confirm_link] – includes a link for the user to confirm their email when the user confirmation setting is enabled
  • [reset_link] – includes a link for the user to set a new password when the “new feature” password reset process is enabled
  • Additionally, any custom field is available based on the field’s option name/meta key found in the Fields tab (excludes “user_login” and “user_email”)
  • [fields] – admin notification only – a list of any of the registration fields
  • [user-ip] – admin notification only – the user’s IP address when they registered
  • [activate-user] – admin notification only – a link to the user profile page so they can be activated (used if moderating registration)

Any field option name can be used as an email shortcode in both emails to users and admins.  So if you have a custom field with the option name “my_field” you can use this in the email as [my_field].

If you have a need for a custom shortcode beyond this, custom shortcodes can be added with the wpmem_email_shortcodes filter.

Some important things to consider:

The plugin installs with certain default settings and email content.  Based on your chosen way of using the plugin, you may need to alter the email content to make sense. Here are some important considerations.

  1. You are not required to use any of the shortcodes (although note #2 below about passwords).  If you want to hardcode a link to something in the email content, that is perfectly fine.  The shortcodes are just a helper for some of these items.  The default example emails are just examples.  Just because something is in the example doesn’t mean you have to use it.  If you don’t like the example, change it.
  2. If you have added a password field to the registration process AND you have set the plugin to moderate registrations for admin approval, you cannot send the password in the “user is approved” email.  If you intend to email a copy of the user’s login credentials in this configuration, you MUST do it in the initial welcome email. That means you will need to make some changes to the fields that are included in the default emails.
  3. The User Profile link is included in the initial email.  However, this is assuming that you have set up a user profile page using the user profile shortcode and have noted the URL location of this page in the plugin’s settings.  If you have not done that, this field will be blank in the message to the user.
  4. The admin notification email by default includes an example of the activation link shortcode.  This does not mean that moderated registration is turned on.  If you use moderated registration you will want this link, but if you do not, feel free to just take it out (unless you would like to have a link to the user profile included in the admin notification email).

If you have additional dynamic content from outside the plugin that needs to be included in your email to a user, there are filters available for this.

Page and Form Shortcodes

The page shortcode is used to create some of the different special pages in WP-Members.

  • login
  • register
  • user profile
  • user profile update
  • password (change|reset)
  • forgot_username
  • TOS
  • user list (premium)

login

[wpmem_form login]

This is another optional page. If you want to be able to direct users to a specific page for login, this shortcode allows you to establish a page strictly for that.

The login page shortcode can accept the parameter redirect_to which allows you to specify a redirect URL upon successful login:
[wpmem_form login redirect_to="http://yoursite.com/some-page/"]

This shortcode has a default logged in state that displays the user’s login status and a link to log out.  While this can be filtered with wpmem_login_links and wpmem_login_links_args, you can also use nested content in the shortcode to create a custom logged in state for this page:

[wpmem_form login]Anything in here displays when the user is logged in[/wpmem_form]

register

[wpmem_form register]

The register attribute creates a registration form/page.  This is strictly optional, since the plugin can place registration in place of the blocked content.  But some people find that they want to direct users to a specific page for registration.  If you have a registration page, you can have a registration link display in all of the login forms.

This shortcode has a default logged in state that displays when the user is logged in.  While this can be filtered with wpmem_register_links and wpmem_register_links_args, you can also use nested content in the shortcode to create a custom logged in state for this page:

[wpmem_form register]Anything in here displays when the user is logged in[/wpmem_form]

While redirects are not recommended, the register form shortcode does accept a redirect_to attribute which allows you to specify a redirect URL upon successful registration:
[wpmem_form register redirect_to="http://yoursite.com/some-page/"]

user profile

[wpmem_profile]

While this page is considered optional in terms of the plugin’s operation of blocking content, it is a recommended page to set up.  This page allows logged in users to change their password (helpful for changing the random password sent by the default plugin setup) and also update their registration information.  Also on this page, a user that is not logged in can reset a forgotten password.

This shortcode has an additional parameter to hide the registration form if desired:
[wpmem_profile register=hide]

Note: If individual components of this page’s processes are desired, you can use [wpmem_form user_edit] and [wpmem_form password] coupled with the [wpmem_logged_in] and [wpmem_logged_out] shortcodes.

user_edit

[wpmem_form user_edit]

The user_edit parameter will establish the necessary form for a user to edit their registration information, not including changing their password.  Since this is only relevant to users who are logged in, this shortcode should only be used in conjunction with the logged in status shortcode so that it is only displayed to a logged in user.

NOTE: This is a single component of the user profile page, so if you have a user profile page already established, you do not need this page as well.  This shortcode is for site admins that might desire a more granular level of control over how these elements are used.

password

[wpmem_form password]

The password parameter will generate a password reset form for users who are not logged in and a change password form for logged in users.  It can be used in conjunction with the logged-in and/or logged-out status shortcodes as well.

NOTE: These functions are also a component of the [wpmem_profile] shortcode, so if you have a user profile page already established, you do not need this page as well.  This shortcode is for site admins that might desire a more granular level of control over how these elements are used.

forgot username

[wpmem_form forgot_username]

Displays the forgot username form. Best used in conjunction with the logged-out status shortcode.

NOTE: This is a single component of the user profile page, so if you have a user profile page already established, you do not need this page as well.  This shortcode is for site admins that might desire a more granular level of control over how these elements are used.

TOS

[wpmem_tos url="https://yoursite.com/your-tos-page"]

This is a special shortcode for the TOS (Terms of Service) dialog, located in the plugin settings under the dialogs tab.  It is only used in the TOS dialog in the plugin’s Dialogs tab and is not actually used on a page. This shortcode requires an additional parameter indicating the url of your Terms of Service.

Note that when using this shortcode, there should be no other text entered into the dialog box other than the shortcode.

user list

[wpmem_ul]

The user-list shortcode is an integration with the WP-Members User List premium add-on module.  When the module is installed, the shortcode allows you to create a page (or set of pages) containing user information, much like a member directory.  Options include navigation, search, and the number of users to display per page.  This shortcode can be used more than once in the site and with the various parameters available could be used to do things like create separate lists of users and authors, etc.

These parameters available to the shortcode are optional:

  • role: determine the fole of the user to list (such as subscriber, author, etc).  The default is to display all roles.
  • number: the number of users that will be displayed per page.  Must be a number.  The default is 10.
  • search: determines whether or not to display the search form.  The default is true.  Setting to “false” turns it off.
  • nav: determines whether or not to display the navigation links (prev/next).  The default is true.  Setting to “false” turns it off.

[wpmem_ul search=false nav=false number=5]

(Note: Any of the optional parameters that are included when the shortcode is used will override that particular setting as it is set in the User List options tab. This is intended for users who may have multiple kinds of lists on their sites with different settings.)

Shortcodes

Available Shortcodes

The plugin’s available shortcodes are described on the following pages:

  • Pages and Forms
  • Login Status
  • Field
  • Memberships
  • Other Shortcodes

Adding a Shortcode

When using the block editor (gutenberg), add a shortcode block (preferred) or a “classic” block.  When using a shortcode block, you can type your shortcode directly into the block.  When using the classic editor or a classic block, you can either type your shortcode into the content area, or you can select a shortcode from the shortcode menu item.   It is also compatible with ClassicPress.

See: How to add a shortcode

Shortcodes Used in Emails

There is a separate set of shortcodes for the plugin that are used strictly in the email content through the plugin’s email administration tab.

Using Email Content Shortcodes

Obsolete Shortcodes

Any shortcodes using the tag [[wp-members]] are now obsolete.  If any of the old tags are used on your site, you may notice entries in your error log indicating that the tag has been deprecated. While the tag will continue to work for now, any of these shortcodes should be replaced with more recent tags.  Here is a reference of the old shortcodes and their replacements.

wpmem_ic_add_code()

Description

API function to add an invite code.

Can add a code using default arguments or specific code attributes.

Parameters

$args
(array)(optional)

Return

Mixed – returns the invite code on success, otherwise false boolean

Useage

$args = array(
    'invite_code'    => 'The_Invite_Code', // Optional, will generate a value by default
    'description'    => 'A description of the invite code', // Optional
    'uses_remaining' => 1, // limit times a code can be used. Optional, will default to null
    'date_created'   => 'YYYY-MM-DD 00:00:00', // MySQL timestamp format Optional, will set by default
    'date_active'    => 'YYYY-MM-DD 00:00:00', // MySQL timestamp format Optional, will set by default
    'date_expired'   => 'YYYY-MM-DD 00:00:00', // MySQL timestamp format Optional, will set by default
);

$invite_code = wpmem_ic_add_code( $args );
  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 6
  • Page 7
  • Page 8
  • Page 9
  • Page 10
  • Interim pages omitted …
  • Page 52
  • Go to Next Page »

Ready to get started?

Join Today!

© 2025 · butlerblog.com · RocketGeek is built using WordPress, WP-Members, and the Genesis Framework

  • butlerblog.com
  • WP-Members Support Subscription
  • Terms of Service
  • Privacy Policy
  • Refund Policy