Cart66 Members Shortcodes
Cart66 Members adds a few shortcodes to help you control access to the content on your WordPress site. You can use the membership restrictions meta box or even use the category restricion settings to require memberships for entire categories of you posts.For more information take a look at the Cart66 Members Add-On overview.
Showing and hiding content
Sometimes you don't want to restrict access to an entire page but rather just to a section of a page. Cart66 Members provides the following shortcodes to allow you to restrict access to just a section of the content on a page or post of your WordPress site.
cm_show_to
Show the enclosed content to visitors who are logged in and have an active membership for one or more of the listed product SKUs.
[cm_show_to sku="basic,gold"] People with a basic or gold membership can see this content [/cm_show_to]
cm_hide_from
This is essentially the opposite of the cm_show_to
shortcode above. Use this shortcode to hide the enclosed content from logged in visitors when an active membership for one or more of the listed product SKUs. This shortcode is often used to show messages to explain that you need to have a membership to view this premium content.
[cm_hide_from sku="gold"] You need to have a gold membership to see the premium content. Sign up now. [/cm_hide_from]
Special SKUs for cm_show_to and cm_hide_from
There are two special SKU values that you can use with the cm_show_to
and cm_hide_from
shortcodes.
guests: Use this shortcode to represent anyone who is not currently logged in.
members: Use this shortcode to represent anyone who is logged in regardless of what memberships they have or even if they memberships are in good standing. Keep in mind, it is possible to be logged in but have your membership expire.
Here is an example of how you might use the guests special SKU.
[cm_show_to sku="guests"] Please remember to log in to view the premium content [/cm_show_to]
Customizing a page with visitor information
There are a few shortcodes to let you provide a customized feel to your website by displaying personal information about the logged in visitor. These shortcodes do not have any parameters and are very simple to use. They can be used in conjunction with the cm_show_to
and cm_hide_from
shortcodes above.
For example, you may want to greet logged in visitors by name, while not showing anything custom to visitors who are not logged in. To do that you could use the following shortcodes.
[cm_show_to sku="members"]Hello [cm_visitor_first_name][/cm_show_to]
Notice the use of multiple shortcodes. First, we use the cm_show_to
shortcode with the special members SKU to make sure this message is only shown to visitors who are logged in. Keep in mind this includes visitors who are logged in but no longer have active subscriptions or memberships.
Then we use the cm_visitor_first_name
shortcode to provide a personalized greeting. This is a great way to customize pages like your member home page - the page on your site where visitors are directed after successfully logging in.
Here is an example of a customized My Account page that you can use as your member home page.
Note: Cart66 provides a few special URLs for interacting with your store. The Update My Information link is just a link to the /sign-in
URL of our site.
cm_visitor_name
Display the logged in visitors full name.
cm_visitor_first_name
Display the logged in visitors first name.
cm_visitor_last_name
Display the logged in visitors last name.
cm_visitor_email
Display the logged in visitors email address.
cm_visitor_phone_number
Display the logged in visitors phone number.