latest stable versions: v140921 (changelog)

s2Member® Codex

Auto-generated documentation for PHP developers. Based on the source code for both s2Member® and s2Member® Pro.

Source Code Documentation


Package s2Member\API_Constants ( Summary )


Easy API Constants for site owners to use in their own projects.

See Also:
full description ( below )
( 8 Classes )
Class Summary
c_ws_plugin__s2member_constants{}
s2Member's API Constants (for site owners).
c_ws_plugin__s2member_pro_alipay_constants{}
AliPay® API Constants (for site owners).
c_ws_plugin__s2member_pro_authnet_constants{}
Authorize.Net® API Constants (for site owners).
c_ws_plugin__s2member_pro_ccbill_constants{}
ccBill® API Constants (for site owners).
c_ws_plugin__s2member_pro_clickbank_constants{}
ClickBank® API Constants (for site owners).
c_ws_plugin__s2member_pro_constants{}
s2Member Pro API Constants (for site owners).
c_ws_plugin__s2member_pro_google_constants{}
Google® API Constants (for site owners).
c_ws_plugin__s2member_pro_paypal_constants{}
PayPal® API Constants (for site owners).
( 64 Globals/Constants )
Global/Constant Summary
S2MEMBER_CURRENT_USER_ACCESS_LABEL
The current User's Membership Access Label.
S2MEMBER_CURRENT_USER_ACCESS_LEVEL
The current User's Membership Access Level.
S2MEMBER_CURRENT_USER_CUSTOM
The current User's Custom String, associated with their Profile.
S2MEMBER_CURRENT_USER_DISPLAY_NAME
The current User's Display Name.
S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
Indicates the number of unique Files the current User is allowed to download every X days.
S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
Indicates the X number of days, configured by the site owner; for the current User.
S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
Does the current User have access to unlimited File Downloads.
S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
Indicates the number of unique Files the current User has downloaded in the last X days.
S2MEMBER_CURRENT_USER_EMAIL
The current User's Email Address.
S2MEMBER_CURRENT_USER_FIELDS
The current User's fields, provided by s2Member.
S2MEMBER_CURRENT_USER_FIRST_NAME
The current User's First Name.
S2MEMBER_CURRENT_USER_ID
The current User's WordPress® User ID.
S2MEMBER_CURRENT_USER_IP
The current User's IP Address (even if/when NOT logged-in).
S2MEMBER_CURRENT_USER_IS_LOGGED_IN
Is the current User logged-in at all.
S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER
Is the current User logged-in as a Member.
S2MEMBER_CURRENT_USER_LAST_NAME
The current User's Last Name.
S2MEMBER_CURRENT_USER_LOGIN
The current User's Username.
S2MEMBER_CURRENT_USER_LOGIN_COUNTER
The number of times the current User has logged into your site.
S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS
The number of days the current User has been a paid Member.
S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME
The current User's first Paid Registration Time; regardless of which paid Level they gained access to.
S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
A URL, which leads to the Stand-Alone Profile Modification Page.
S2MEMBER_CURRENT_USER_REGISTRATION_DAYS
The number of days the current User has had an account, period.
S2MEMBER_CURRENT_USER_REGISTRATION_IP
IP Address the current User had during registration.
S2MEMBER_CURRENT_USER_REGISTRATION_TIME
The current User's Registration Time.
S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY
The current User's Paid Subscription Gateway Code (when applicable).
S2MEMBER_CURRENT_USER_SUBSCR_ID
The current User's Paid Subscription ID (when applicable).
S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID
The current User's Paid Subscription ID (when applicable); otherwise, this will contain their WordPress® User ID.
S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0
PayPal® value for Payment Buttons with input name: on0.
S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1
PayPal® value for Payment Buttons with input name: on1.
S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0
PayPal® value for Payment Buttons with input name: os0.
S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1
PayPal® value for Payment Buttons with input name: os1.
S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
Inline File Download extensions; as configured by the site owner.
S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
The configured Page ID, for the Download Limit Exceeded Page.
S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
A URL, which leads to the Download Limit Exceeded Page; as configured by the site owner.
S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
File Downloads allowed at each Membership Level; as configured by the site owner.
S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
File Download days, at each Membership Level; as configured by the site owner.
S2MEMBER_LEVELn_LABEL
Each Membership Level (Label); as configured by the site owner.
S2MEMBER_LOGIN_PAGE_URL
The URL, where a User can log into their account.
S2MEMBER_LOGIN_WELCOME_PAGE_ID
The configured Page ID, for the Login Welcome Page.
S2MEMBER_LOGIN_WELCOME_PAGE_URL
The URL, which leads to the Login Welcome Page; as configured by the site owner.
S2MEMBER_LOGOUT_PAGE_URL
The URL, which logs the current User out of their account.
S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
The configured Page ID, for the Membership Options Page.
S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
A URL, which leads to the Membership Options Page; as configured by the site owner.
S2MEMBER_PAYPAL_API_ENDPOINT
PayPal® API endpoint domain (changes when Sandbox Mode is enabled).
S2MEMBER_PAYPAL_API_PASSWORD
PayPal® API Password; as configured by the site owner.
S2MEMBER_PAYPAL_API_SIGNATURE
PayPal® API Signature; as configured by the site owner.
S2MEMBER_PAYPAL_API_USERNAME
PayPal® API Username; as configured by the site owner.
S2MEMBER_PAYPAL_BUSINESS
PayPal® Business Email Address; as configured by the site owner.
S2MEMBER_PAYPAL_ENDPOINT
PayPal® endpoint domain (changes when Sandbox Mode is enabled).
S2MEMBER_PAYPAL_NOTIFY_URL
Full URL to PayPal® IPN handler, provided by s2Member.
S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN
PayPal® PDT Identity Token; as configured by the site owner.
S2MEMBER_PAYPAL_RETURN_URL
Full URL to PayPal® Auto-Return/PDT handler, provided by s2Member.
S2MEMBER_PRO_ALIPAY_GATEWAY
Flag indicating the AliPay® Gateway is active.
S2MEMBER_PRO_AUTHNET_GATEWAY
Flag indicating the Authorize.Net® Gateway is active.
S2MEMBER_PRO_CCBILL_GATEWAY
Flag indicating the ccBill® Gateway is active.
S2MEMBER_PRO_CLICKBANK_GATEWAY
Flag indicating the ClickBank® Gateway is active.
S2MEMBER_PRO_GOOGLE_GATEWAY
Flag indicating the Google® Gateway is active.
S2MEMBER_PRO_PAYPAL_GATEWAY
Flag indicating the PayPal® Gateway is active.
S2MEMBER_PRO_VERSION
Current version of s2Member Pro.
S2MEMBER_REG_EMAIL_FROM_EMAIL
From: Email Address, for s2Member-specific emails; as configured by the site owner.
S2MEMBER_REG_EMAIL_FROM_NAME
From: Name, for s2Member-specific emails; as configured by the site owner.
S2MEMBER_VALUE_FOR_PP_INV
PayPal® value for Payment Buttons with input name: invoice.
S2MEMBER_VERSION
Current version of s2Member.
WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5
Used internally by s2Member to compare the value of all API Constants at once.

Easy API Constants for site owners to use in their own projects.

These are PHP Constants designed specifically for site owners and developers. They make it easy to integrate s2Member® with themes and other plugins. Basic permissions, details about the current User; and even configuration options, are all included in this package.

Unless noted otherwise, all of the s2Member\API_Constants, are also available through JavaScript, as Global Variables (with the exact same names/types as their PHP counterparts). s2Member® automatically loads it's compressed JavaScript API into your theme for WordPress®. s2Member® is very intelligent about the way it loads (and maintains) it's JavaScript API. You can rely on the JavaScript Globals, the same way you rely on PHP Constants. The only exceptions are related to security. Variables that include private server-side details, like Identity Tokens and other API service credentials, will be excluded automatically.

We recommend using these s2Member\API_Constants, s2Member\API_Functions, or Hooks/Filters (over 1000 spread throughout all packages) to complete an advanced integration with s2Member®. Please try to refrain from using other internal constants/classes/methods whenever possible; as those are subject to change from one release to the next. Conversely, the availability of API Constants, API Functions, and Hooks/Filters will remain from one version to another. Only in rare circumstances would we ever remove one of these key elements; and if we do, backward compatibility would always remain when the previous version is deprecated for whatever reason.

Many of these API Constants and API Functions are designed to supplement existing core functionality that comes with WordPress®. For instance, these WordPress® functions are also very useful, and notes to this effect are spread throughout the documentation here.

See Also: s2Member\API_Functions


Hacking s2Member (it's easy with Hooks/Filters for WordPress®)

If you need to add custom processing routines, or modify the behavior of existing processing routines; please use s2Member's Hooks/Filters for WordPress®. Hooks & Filters, give you the ability to "hook into", and/or "filter" processing routines, with files/functions of your own; instead of editing the s2Member® plugin files directly. This way you won't need to merge your changes/tweaks each time a new version of s2Member® is released. To create custom processing routines, place those routines into a PHP file here: /wp-content/mu-plugins/s2-hacks.php. If you don't have an /mu-plugins/ directory, please create one. These are (mu) MUST USE plugins, which are loaded into WordPress® automatically; that's what you want! If you're not familiar with Hooks/Filters for WordPress®, please read this article in the WordPress® Codex.

Adding a Hook (inside /wp-content/mu-plugins/s2-hacks.php)

Please make sure there are NO blank lines in your PHP file. Do NOT introduce spaces/tabs/lines before or after the <?php ?> tags.

  1. <?php
  2. add_action("hook_name", "my_action_hook_function");
  3. function my_action_hook_function($vars = array())
  4. {
  5. echo "My Hook works.";</p><p> # Optional. s2Member® passes you an array of defined variables.
  6. # print_r($vars); # Would give you a list of defined variables.
  7. # These are PHP variables defined within the scope of the Hook,
  8. # at the precise point in which the Hook is fired by s2Member®.</p><p> # $vars["__refs"] are also included (with some Hooks).
  9. # These are internal PHP variable references (very useful).
  10. # To learn all about references, please see PHP documentation:
  11. # http://www.php.net/manual/en/language.references.pass.php
  12. }
  13. ?>

Adding a Filter (inside /wp-content/mu-plugins/s2-hacks.php)

Please make sure there are NO blank lines in your PHP file. Do NOT introduce spaces/tabs/lines before or after the <?php ?> tags.

  1. <?php
  2. add_filter("filter_name", "my_filtering_function", 10, 2);
  3. function my_filtering_function($original_value, $vars = array())
  4. {
  5. if($original_value !== "something I like")
  6. return ($my_custom_value = "My Filter works.");</p><p> else # Return original value.
  7. return $original_value;</p><p> # Optional. s2Member® passes you an array of defined variables.
  8. # print_r($vars); # Would give you a list of defined variables.
  9. # These are PHP variables defined within the scope of the Filter,
  10. # at the precise point in which the Filter is fired by s2Member®.</p><p> # $vars["__refs"] are also included (with some Filters).
  11. # These are internal PHP variable references (very useful).
  12. # To learn all about references, please see PHP documentation:
  13. # http://www.php.net/manual/en/language.references.pass.php
  14. }
  15. ?>


Source Code Documentation

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.