Short Code Guide - YourMembers/yourmembers GitHub Wiki
Your Members uses a set of shortcodes to help provide additional functionality to posts each code and its use is described below.
How to use a shortcode in Visual Editor If you are using the visual editor then you will need to switch to the HTML view to place the short codes into your post. Simply click the HTML button add the shortcode and switch back.
Private – Usage [private][/private] Content inside private tags is protected with only users with account types selected from the sidebar being able to access. If a user does not have access they are shown an error message which can be defined in Messages within Your Members admin area. Additionally you can set an override message via [private override_message="This is an override"][/private] which overrides the message drom Messages.
Private – Usage [private_and#xxx][/private_and] Content inside private tags is protected with only users with account types selected on the page and in the tag being able to access content. If a user does not have access they are shown an error message which can be defined in Messages within Your Members admin area.
Private – Usage [private_or#xxxx][/private_or] Content inside private tags is protected with only users with account types selected on the page or in the tag being able to access content. If a user does not have access they are shown an error message which can be defined in Messages within Your Members admin area.
No Access – Usage [no_access post_id="x"][/no_access] The opposite of private tag content within this tag will only be shown to users who do not have access to the private tags. This allows you to create additional sales or other information on pages for people who cant see the private content. Note: Users who have the capability of editing the page see noaccess content highlighted in salmon to make it easy to identify, normal users do not see a salmon background. The argument post_id is optional and defaults to the post the shortcode is on.
User Has Access – Usage [user_has_access post_id="x"][/user_has_access] This tag will show content within if the user has access to the post or page, if the user does not have access to that post then they will be shown no content at all. The argument post_id is optional and defaults to the post the shortcode is on.
Download – Usage [download#xx] This tag is for inserting a placeholder for a link to a Your Member download where xx is the Downloads unique ID. For more information please on how to create a download please see the download manager tutorial.
Registration Form - Usages [ym_register id=xx hide_custom_fields=yy,zz] Provides a User Registration form that will forward on to payment gateways by default [ym_register] this simply replicates the form generated at example.com/wp-login.php?action=register however if an id is set then this will override the ability to choose a subscriptions, and enforce a single subscription this is useful when combined with hidden subscriptions, to allow special private registration pages for special guests. Note if you allow coupons, with special memberships, they will overwrite the membership set here if used. You can specify id="get" to which the shortcode will attempt to use a Package ID obtained from the PHP $_REQUEST variable id (so ?id=x or posted from a form for example). This can simplify the need to have multiple pages when using a Sales flow with Multiple pages containing just a ym_register short code.
Registration Flows - Usages [ym_register flow=xx id=xx] This is an extension of the ym_register shortcode, but can also handle upgrades. Specifying a flow ID makes the shortcode switch to registration flow mode. The ID also supports loading from $_REQUEST if you set the ID to 'get' and supply a id=x via get or Post.
Upgrade Form - usage [ym_upgrade] As per upgrade widget. Supports id="x". The ID also supports loading from $_REQUEST if you set the ID to 'get' and supply a id=x via get or Post.
Membership Content – Usage [ym_membership_content snippets=0] Equivalent of the Membership Content page for each user. We recommend you wrap this in private tags. It shows boxes to list the content you have access to with your existing account type and all the content and bundles you have purchased. If you add the optional argument snippets=0 then the extracts will not be shown.
[ym_user_is]content[/ym_user_is] If the user matches the relevant argument, show the content. This shortcode can use one of the following arguments. Otherwise False/empty string is returned
- package - a Package ID
- package_type - a Package Type
- username - a Username
- role - a WordPress role or Capability, this uses the current_user_can function
[ym_user_is_not]content[/ym_user_is_not] Does the opposite of ym_user_is
Login Form - Usage [ym_login] Creates a login form for users to Login to the site. Its a duplicate of the form found on wp-login.php excluding the logo/link above the form. Possible Arguments
- register_text="x" show a register link using x as the text
- lostpassword_text="x" show a lost password link using x as the text
- redirect="x" a URL to redirect the user to on login complete, do not include the Site URL, so /page/ not http://exmaple.com/page/
Account Information - Usage [ym_profile] Information is shown in a table about the users account and subscription. A report on the account type, expiry date, last payment etc.. The same table that shows at the top of the YM profile page
Replacement Profile Controls - usage [ym_user_profile_form] [ym_user_password_form] If you block user access to WP Admin, you may want to include a method to allow users to update their profile and/or password. They are duplicate forms to that shown on the default/standard WordPress Your Profile page.
User Modification - Usage [ym_user_profile] Generates a replicated form for a logged in user of their YM Custom Profile fields.
Arguments show_custom_fields or hide_custom_fields, a comma separated list of custom fields (by name) to show/hide respectivly
User First Name - Usage [ym_user_first_name] Does what it says on the tin. Shows the users first name from the First Name field on the profile. Useful for personalised greetings
User Last Name - Usage [ym_user_last_name] Does what it says on the tin. Shows the users last name from the Last Name field on the profile. Useful for personalised greetings
Username - Usage [ym_user_username] Does what it says on the tin. Shows the users user name from their account. Useful for personalised greetings
User Email - Usage [ym_user_email] Does what it says on the tin. Shows the users email from their account. Useful for personalised greetings
Users Register Date - Usage [ym_user_register_date] Does what it says on the tin. Shows the date the user registered.
Users Description/Bio - Usage [ym_user_description] Does what it says on the tin. Shows the user Description/bio.
Users Custom Field - Usage [ym_user_custom name="field_name" alt="alternate text"] Show the current logged in users value for the custom field of name, alt which is optional will be displayed if the user does not have a value. If you look for a key/field name that matches one of the other ym_users above then the relevant user meta is returned as the custom fields sync.
A user can optionally cancel their subscription. Some Gateways provide a button/method to do this.
[ym_gateway_cancel] If the gateway the user last used provides a method to cancel the subscription then this shortcode will render that button Supported arguments:
- text="x" - use the text x to introduce the button/method
- button="x" - change the text shown on the button to cancel the account/perform the gateway cancel action
[ym_user_unsubscribe] A button to cancel the users account with your site. It does not cancel any pending or future payment gateway transactions Supported arguments:
- unsubscribe_text="x" - use the text x to introduce the button/method
- sure_button="x" - change the text shown on the "Are you Sure" button to cancel the account/perform the gateway cancel action
- unsubscribe_button="x" - change the text shown on the "Cancel" button to cancel the account/perform the gateway cancel action
Bundle Purchase Button - usage [ym_buy_bundle bundle_id=x gateways="x" hidecoupon="1/0"]
This creates a buy now button to purchase a Bundle identified by bundle_id. Gateways allow you to pick which gateways to allow customers to use (if that gateway is enabled), using gateways="ym_paypal|ym_2checkout" for example allows the PayPal and 2Checkout gateways. Hidecoupon if set to 1 hides the coupon field.
Post Purchase Button - usage [ym_buy_content post_id=x gateways="x" hidecoupon="1/0" showtitle="1/0"]
This creates a buy now button to purchase a Post/Page identified by post_id. If no post id is specified then the post ID of the post the code is used on is used. Gateways allow you to pick which gateways to allow customers to use (if that gateway is enabled), using gateways="ym_paypal|ym_2checkout" for example allows the PayPal and 2Checkout gateways. Hidecoupon if set to 1 hides the coupon field. Showtitle shows the post title, so in case where you are putting buy buttons for a post on a bespoke page then this will enable showing of the post title with the Buy Now button. (Where as if the shortcode is used on the post its selling then the post title is already shown). This short code will filter out and remove the [private] tagged content to remove the blue box saying the post is purchasable.
[ym_all_content] Display all Purchasable Content. Supports the following arguments
- category - either the name or ID of a category of posts to display, Values: 1 or 0, Default: off
- hide_purchased - if on hide purchased posts, if on show links to purchased content, Values: 1 or 0, Default: off
- max - specify the number of purchased posts to show, (paginates if max reached), Values: a number, Default: off
- gateways - passes the argument thru to the [ym_buy_content] shortcode
- hidecoupon - passes the argument thru to the [ym_buy_content] shortcode
[ym_all_bundles] Display all Purchasable Bundles. Supports the following arguments
- hide_purchased - if on hide purchased posts, if on show links to purchased content, Values: 1 or 0, Default: off
- max - specify the number of purchased posts to show, (paginates if max reached), Values: a number, Default: off
- gateways - passes the argument thru to the [ym_buy_content] shortcode
- hidecoupon - passes the argument thru to the [ym_buy_content] shortcode
- list_contents - passes the argument thru to the [ym_buy_content] shortcode, also shows the contents on this page
[ym_featured_content] As per [ym_all_content] but only shows featured content Supports the same Arguments
Individual Content Purchase Attributes
- [ym_content_units_left post_id="x"] - Shows the number of Content left for post_id x, if no post_id, uses the Post ID of the Page its on
- [ym_content_units_sold post_id="x"] - Shows the number of Content Units sold for post_id x, if no post_id, uses the Post ID of the Page its on
- [ym_content_units_limit post_id="x"] - Show the Total Available units of Content post_id x, if no post_id, uses the Post ID of the Page its on
- [ym_content_expiry_date post_id="x"] - Show the Access Expiry date for the Content post_id x, if no post_id, uses the Post ID of the Page its on
- [ym_content_purchase_date post_id="x"] - Show the purchased date for the Content post_id x, if no post_id, uses the Post ID of the Page its on
<li>[ym_bundle_units_left bundle_id="x"] - Shows the number of Bundles left for bundle_id x</li>
<li>[ym_bundle_units_sold bundle_id ="x"] - Shows the number of Bundles Units sold for bundle_id x</li>
<li>[ym_bundle_units_limit bundle_id ="x"] - Show the Total Available units of Bundles bundle_id x, if no post_id</li>
<li>[ym_bundle_expiry_date bundle_id ="x"] - Show the Access Expiry date for the Bundles bundle_id x, if no post_id</li>
<li>[ym_bundle_purchase_date bundle_id ="x"] - Show the purchased date for the Bundles bundle_id x, if no post_id</li>
For YM 10.0.6 and Up
If you are using a Per Pack Redirect, or redirecting to a page that is not a wp-login page, you will need to place [ym_callback_js] on you page in order to include the JS Callback from the Gateway
The following shortcodes can be used in the Payment Gateway Callback Script field only
[user_id] Substitutes for the Signed up users WordPress ID
[pack_id] Substitutes for the just purchased Pack ID
[cost] Substitutes for how much they paid
[account_type] Substitutes for the account type purchased
Like Button - Usage[ym_fb_like]
Displays a Facebook "Like" Button
Profile Info - Usage[ym_fb_profile]Displays User Profile Info
User Status - Usage[ym_fb_user_status]Displays User Status Information
Leave Facebook - Usage[ym_fb_leave_facebook]Generates a link that points people back to the WordPress version of the page (only visible when in Facebook).
Send to Facebook - Usage[ym_fb_force_facebook]
Forces the Page to reload inside Facebook
Send to WordPress - Usage[ym_fb_force_leave_facebook]Forces the Page to reload inside WordPress
If in Facebook - Usage[ym_fb_if_in_facebook]Some text here[/ym_fb_if_in_facebook]
If not in Facebook - Usage[ym_fb_if_not_in_facebook]Some text here[/ym_fb_if_not_in_facebook] If Like - Usage[ym_fb_if_like]Some text here[/ym_fb_if_like] If Not Like - Usage[ym_fb_if_not_like]Some text here[/ym_fb_if_not_like] ???? - Usage[ym_fb_like_wall]Some text here[/ym_fb_like_wall] ???? - Usage[ym_fb_like_wall_like]Some text here[/ym_fb_like_wall_like] ???? - Usage[ym_fb_like_wall_not_like]Some text here[/ym_fb_like_wall_not_like] If Logged into WordPress - Usage[ym_fb_wp_logged_in]Some text here[/ym_fb_wp_logged_in] If Not Logged into WordPress - Usage[ym_fb_wp_not_logged_in]Some text here[/ym_fb_wp_not_logged_in] If Logged into Facebook - Usage[ym_fb_fb_logged_in]Some text here[/ym_fb_fb_logged_in] If Not Logged into Facebook - Usage[ym_fb_fb_not_logged_in]Some text here[/ym_fb_fb_not_logged_in]