Jason just coded up a new shortcode feature for a support customer and we wanted to share it—hooray open source! It’s a little tricky to explain, but once you wrap your brain around the features, you’ll begin to think of interesting ways to apply it to your membership site.
The shortcode is primarily useful for sites that offer free trials and want to show (or hide) content to users who are on the trial vs. those that are full paying members.
A little more detail…
The “haspaid” shortcode detailed below looks up a member’s order history and checks whether their current level or any past levels have a positive order total value. Then, using the shortcode attributes, you can show or hide content only to members that match your criteria.
For example, the image above shows an upgrade message to members on a free trial of level ID 1 that have NEVER paid for the level. This is the shortcode and content used to create that callout.
Members of level ID 1 that are paying (full members) will not see this callout or any interruption in the standard content of your page/post.
Another example may be to wrap the
[haspaid] shortcode inside of the
[membership] shortcode to show an upgrade notice to members who USED to be a higher tier and are now a lower tier. For example:
- paid: Accepts ‘true’ (has paid) or ‘false’ (hasn’t paid); default: true
- level: The level ID to check against. Accepts any level ID; default: none.
[haspaid] This will show up if the user has paid for any level. [/haspaid]
[haspaid paid='0'] This will show up if the user has NOT paid for any level. [/haspaid]
[haspaid paid='1' level='1'] This will show up if the user has paid for level 1 specifically. [/haspaid]
[haspaid paid='0' level='1'] This will show up if the user has not paid for level 1 specifically. [/haspaid]