Source Code Documentation


s2member\includes\classes\constants.inc.php


  1. <?php
  2. /**
  3. * s2Member's API Constants *(for site owners)*.
  4. *
  5. * Copyright: © 2009-2011
  6. * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
  7. * (coded in the USA)
  8. *
  9. * Released under the terms of the GNU General Public License.
  10. * You should have received a copy of the GNU General Public License,
  11. * along with this software. In the main directory, see: /licensing/
  12. * If not, see: {@link http://www.gnu.org/licenses/}.
  13. *
  14. * @package s2Member\API_Constants
  15. * @since 3.5
  16. */
  17. if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
  18. exit("Do not access this file directly.");
  19.  
  20. if (!class_exists ("c_ws_plugin__s2member_constants"))
  21. {
  22. /**
  23. * s2Member's API Constants *(for site owners)*.
  24. *
  25. * @package s2Member\API_Constants
  26. * @since 3.5
  27. */
  28. class c_ws_plugin__s2member_constants
  29. {
  30. /**
  31. * Defines several API Constants for s2Member.
  32. *
  33. * These are also duplicated into the JavaScript API for s2Member.
  34. * Except for a few that would pose a security issue. Such as the PayPal® API Credentials;
  35. * those are NOT included in the JavaScript API.
  36. *
  37. * @package s2Member\API_Constants
  38. * @since 3.5
  39. *
  40. * @attaches-to ``add_action("init");``
  41. *
  42. * @return null
  43. */
  44. public static function constants ()
  45. {
  46. do_action ("ws_plugin__s2member_before_constants", get_defined_vars ());
  47.  
  48. $links = c_ws_plugin__s2member_cache::cached_page_links ();
  49.  
  50. $user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && $user->ID) ? $user : false;
  51.  
  52. $level = c_ws_plugin__s2member_user_access::user_access_level ($user);
  53. $file_downloads = c_ws_plugin__s2member_files::user_downloads ($user);
  54. $login_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user);
  55.  
  56. $custom = ($user) ? get_user_option ("s2member_custom", $user->ID) : "";
  57. $subscr_id = ($user) ? get_user_option ("s2member_subscr_id", $user->ID) : "";
  58. $subscr_gateway = ($user) ? get_user_option ("s2member_subscr_gateway", $user->ID) : "";
  59. $registration_ip = ($user) ? get_user_option ("s2member_registration_ip", $user->ID) : "";
  60. $custom_fields = ($user) ? get_user_option ("s2member_custom_fields", $user->ID) : array ();
  61. $paid_registration_times = ($user) ? get_user_option ("s2member_paid_registration_times", $user->ID) : array ();
  62. $login_counter = ($user) ? (int)get_user_option ("s2member_login_counter") : -1;
  63.  
  64. foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
  65. do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
  66. unset /* Unset defined __refs, __v. */ ($__refs, $__v);
  67. /**
  68. * Current version of s2Member.
  69. *
  70. * ———— Quick PHP Code Sample ————
  71. * ```
  72. * <!php echo S2MEMBER_VERSION; !>
  73. * ```
  74. * ———— Shortcode & JavaScript Equivalents ————
  75. * ```
  76. * [s2Get constant="S2MEMBER_VERSION" /]
  77. *
  78. * <script type="text/javascript">
  79. * document.write(S2MEMBER_VERSION);
  80. * </script>
  81. * ```
  82. *
  83. * @package s2Member\API_Constants
  84. * @since 3.5
  85. *
  86. * @var str
  87. *
  88. * @see s2Member\WS_PLUGIN__S2MEMBER_VERSION
  89. */
  90. if (!defined ("S2MEMBER_VERSION"))
  91. define ("S2MEMBER_VERSION", ($c[] = (string)WS_PLUGIN__S2MEMBER_VERSION));
  92. /**
  93. * The number of times the current User has logged into your site.
  94. *
  95. * Negative `-1` through number of times logged-in.
  96. * Negative `-1` indicates they are NOT logged-in.
  97. *
  98. * ———— Quick PHP Code Sample ————
  99. * ```
  100. * <!php echo S2MEMBER_CURRENT_USER_LOGIN_COUNTER; !>
  101. * ```
  102. * ———— Shortcode & JavaScript Equivalents ————
  103. * ```
  104. * [s2Get constant="S2MEMBER_CURRENT_USER_LOGIN_COUNTER" /]
  105. *
  106. * <script type="text/javascript">
  107. * document.write(S2MEMBER_CURRENT_USER_LOGIN_COUNTER);
  108. * </script>
  109. * ```
  110. *
  111. * @package s2Member\API_Constants
  112. * @since 110720
  113. *
  114. * @var int
  115. *
  116. * @see s2Member\API_Functions\get_user_field()
  117. * @see `get_user_field("s2member_login_counter")`
  118. *
  119. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  120. */
  121. if (!defined ("S2MEMBER_CURRENT_USER_LOGIN_COUNTER"))
  122. define ("S2MEMBER_CURRENT_USER_LOGIN_COUNTER", ($c[] = (int)$login_counter));
  123. /**
  124. * Is the current User logged-in at all.
  125. *
  126. * True if the current User IS logged-in, else false.
  127. *
  128. * ———— Quick PHP Code Sample ————
  129. * ```
  130. * <!php
  131. * if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN)
  132. * echo 'You ARE logged in.';
  133. * !>
  134. * ```
  135. * ———— Shortcode & JavaScript Equivalents ————
  136. * ```
  137. * [s2If constant(S2MEMBER_CURRENT_USER_IS_LOGGED_IN)]
  138. * You ARE logged-in.
  139. * [/s2If]
  140. *
  141. * <script type="text/javascript">
  142. * if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN)
  143. * document.write('You ARE logged-in.');
  144. * </script>
  145. * ```
  146. *
  147. * @package s2Member\API_Constants
  148. * @since 3.5
  149. *
  150. * @var bool
  151. *
  152. * @see s2Member\API_Functions\is_user_not_logged_in()
  153. * @see http://codex.wordpress.org/Function_Reference/is_user_logged_in is_user_logged_in()
  154. *
  155. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  156. */
  157. if (!defined ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN"))
  158. define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN", ($c[] = (($user) ? true : false)));
  159. /**
  160. * Is the current User logged-in as a Member.
  161. *
  162. * True if the current User IS logged-in with a Membership Level greater than `0`, else false.
  163. *
  164. * ———— Quick PHP Code Sample ————
  165. * ```
  166. * <!php
  167. * if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER)
  168. * echo 'You ARE logged in at Level #1 or higher.';
  169. * !>
  170. * ```
  171. * ———— Shortcode & JavaScript Equivalents ————
  172. * ```
  173. * [s2If constant(S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER)]
  174. * You ARE logged in at Level #1 or higher.
  175. * [/s2If]
  176. *
  177. * <script type="text/javascript">
  178. * if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER)
  179. * document.write('You ARE logged in at Level #1 or higher.');
  180. * </script>
  181. * ```
  182. *
  183. * @package s2Member\API_Constants
  184. * @since 3.5
  185. *
  186. * @var bool
  187. *
  188. * @see s2Member\API_Functions\is_user_not_logged_in()
  189. * @see http://codex.wordpress.org/Function_Reference/is_user_logged_in is_user_logged_in()
  190. *
  191. * @see s2Member\API_Functions\user_is()
  192. * @see s2Member\API_Functions\user_is_not()
  193. *
  194. * @see s2Member\API_Functions\current_user_is()
  195. * @see s2Member\API_Functions\current_user_is_not()
  196. * @see s2Member\API_Functions\current_user_is_for_blog()
  197. * @see s2Member\API_Functions\current_user_is_not_for_blog()
  198. *
  199. * @see s2Member\API_Functions\current_user_cannot()
  200. * @see s2Member\API_Functions\current_user_cannot_for_blog()
  201. * @see http://codex.wordpress.org/Function_Reference/user_can user_can()
  202. * @see http://codex.wordpress.org/Function_Reference/current_user_can current_user_can()
  203. * @see http://codex.wordpress.org/Function_Reference/current_user_can_for_blog current_user_can_for_blog()
  204. *
  205. * @see s2Member\API_Functions\get_user_field()
  206. * @see `get_user_field("s2member_access_role")`
  207. * @see `get_user_field("s2member_access_level")`
  208. * @see `get_user_field("s2member_access_label")`
  209. *
  210. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  211. */
  212. if (!defined ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER"))
  213. define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER", ($c[] = (($user && $level >= 1) ? true : false)));
  214. /**
  215. * The current User's Membership Access Level.
  216. *
  217. * Negative `-1` through max Membership Level number.
  218. * Negative `-1` indicates they are NOT logged-in.
  219. *
  220. * ———— Quick PHP Code Sample ————
  221. * ```
  222. * <!php echo S2MEMBER_CURRENT_USER_ACCESS_LEVEL; !>
  223. * ```
  224. * ———— Shortcode & JavaScript Equivalents ————
  225. * ```
  226. * [s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LEVEL" /]
  227. *
  228. * <script type="text/javascript">
  229. * document.write(S2MEMBER_CURRENT_USER_ACCESS_LEVEL);
  230. * </script>
  231. * ```
  232. *
  233. * @package s2Member\API_Constants
  234. * @since 3.5
  235. *
  236. * @var int
  237. *
  238. * @see s2Member\API_Functions\get_user_field()
  239. * @see `get_user_field("s2member_access_role")`
  240. * @see `get_user_field("s2member_access_level")`
  241. * @see `get_user_field("s2member_access_label")`
  242. *
  243. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ACCESS_LABEL
  244. *
  245. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  246. */
  247. if (!defined ("S2MEMBER_CURRENT_USER_ACCESS_LEVEL"))
  248. define ("S2MEMBER_CURRENT_USER_ACCESS_LEVEL", ($c[] = (int)$level));
  249. /**
  250. * The current User's Membership Access Label.
  251. *
  252. * As configured by the site owner. Each Membership Level is associated with a Membership Label
  253. * *(i.e. Bronze, Silver, Gold, Platinum)*, or whatever the site owner has configured.
  254. *
  255. * An empty string if NOT logged-in.
  256. *
  257. * ———— Quick PHP Code Sample ————
  258. * ```
  259. * <!php echo S2MEMBER_CURRENT_USER_ACCESS_LABEL; !>
  260. * ```
  261. * ———— Shortcode & JavaScript Equivalents ————
  262. * ```
  263. * [s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LABEL" /]
  264. *
  265. * <script type="text/javascript">
  266. * document.write(S2MEMBER_CURRENT_USER_ACCESS_LABEL);
  267. * </script>
  268. * ```
  269. *
  270. * @package s2Member\API_Constants
  271. * @since 3.5
  272. *
  273. * @var str
  274. *
  275. * @see s2Member\API_Functions\get_user_field()
  276. * @see `get_user_field("s2member_access_role")`
  277. * @see `get_user_field("s2member_access_level")`
  278. * @see `get_user_field("s2member_access_label")`
  279. *
  280. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ACCESS_LEVEL
  281. *
  282. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  283. */
  284. if (!defined ("S2MEMBER_CURRENT_USER_ACCESS_LABEL"))
  285. define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]));
  286. /**
  287. * The current User's Paid Subscription ID (when applicable).
  288. *
  289. * An empty string if NOT logged-in.
  290. *
  291. * ———— Quick PHP Code Sample ————
  292. * ```
  293. * <!php echo S2MEMBER_CURRENT_USER_SUBSCR_ID; !>
  294. * ```
  295. * ———— Shortcode & JavaScript Equivalents ————
  296. * ```
  297. * [s2Get constant="S2MEMBER_CURRENT_USER_SUBSCR_ID" /]
  298. *
  299. * <script type="text/javascript">
  300. * document.write(S2MEMBER_CURRENT_USER_SUBSCR_ID);
  301. * </script>
  302. * ```
  303. *
  304. * @package s2Member\API_Constants
  305. * @since 3.5
  306. *
  307. * @var str
  308. *
  309. * @see s2Member\API_Functions\get_user_field()
  310. * @see `get_user_field("s2member_subscr_id")`
  311. *
  312. * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
  313. * @see `get_user_option("s2member_subscr_id")`
  314. *
  315. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_CUSTOM
  316. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID
  317. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY
  318. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
  319. *
  320. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  321. */
  322. if (!defined ("S2MEMBER_CURRENT_USER_SUBSCR_ID"))
  323. define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", ($c[] = (($user) ? (string)$subscr_id : "")));
  324. /**
  325. * The current User's Paid Subscription ID (when applicable);
  326. * otherwise, this will contain their WordPress® User ID.
  327. *
  328. * An empty string if NOT logged-in.
  329. *
  330. * ———— Quick PHP Code Sample ————
  331. * ```
  332. * <!php echo S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID; !>
  333. * ```
  334. * ———— Shortcode & JavaScript Equivalents ————
  335. * ```
  336. * [s2Get constant="S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID" /]
  337. *
  338. * <script type="text/javascript">
  339. * document.write(S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID);
  340. * </script>
  341. * ```
  342. *
  343. * @package s2Member\API_Constants
  344. * @since 3.5
  345. *
  346. * @var str
  347. *
  348. * @see s2Member\API_Functions\get_user_field()
  349. * @see `get_user_field("s2member_subscr_or_wp_id")`
  350. *
  351. * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
  352. * @see `get_user_option("s2member_subscr_id")`
  353. *
  354. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_CUSTOM
  355. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_ID
  356. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY
  357. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
  358. *
  359. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  360. */
  361. if (!defined ("S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID"))
  362. define ("S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID", ($c[] = (($user) ? (($subscr_id) ? (string)$subscr_id : (string)$user->ID) : "")));
  363. /**
  364. * The current User's Paid Subscription Gateway Code (when applicable).
  365. *
  366. * Usually one of these values: `paypal`, `authnet`, `clickbank`, `google`, `ccbill`, `alipay`.
  367. *
  368. * An empty string if NOT logged-in, or if NOT a paying Member.
  369. *
  370. * ———— Quick PHP Code Sample ————
  371. * ```
  372. * <!php echo S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY; !>
  373. * ```
  374. * ———— Shortcode & JavaScript Equivalents ————
  375. * ```
  376. * [s2Get constant="S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY" /]
  377. *
  378. * <script type="text/javascript">
  379. * document.write(S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY);
  380. * </script>
  381. * ```
  382. *
  383. * @package s2Member\API_Constants
  384. * @since 3.5
  385. *
  386. * @var str
  387. *
  388. * @see s2Member\API_Functions\get_user_field()
  389. * @see `get_user_field("s2member_subscr_gateway")`
  390. *
  391. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_CUSTOM
  392. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_ID
  393. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID
  394. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
  395. *
  396. * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
  397. * @see `get_user_option("s2member_subscr_gateway")`
  398. */
  399. if (!defined ("S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY"))
  400. define ("S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY", ($c[] = (($user) ? (string)$subscr_gateway : "")));
  401. /**
  402. * The current User's Custom String, associated with their Profile.
  403. *
  404. * For paying Members, this should always start with the installation domain name.
  405. * This is taken from the `custom=""` Attribute in your Button/Form Shortcode.
  406. *
  407. * Other pipe delimited values may follow the installation domain name, if configured by the site owner.
  408. * For instance, this might be equal to something like: `www.example.com|cv1|cv2|cv3`.
  409. *
  410. * An empty string if NOT logged-in, or if NOT a paying Member.
  411. *
  412. * ———— Quick PHP Code Sample ————
  413. * ```
  414. * <!php echo S2MEMBER_CURRENT_USER_CUSTOM; !>
  415. * ```
  416. * ———— Shortcode & JavaScript Equivalents ————
  417. * ```
  418. * [s2Get constant="S2MEMBER_CURRENT_USER_CUSTOM" /]
  419. *
  420. * <script type="text/javascript">
  421. * document.write(S2MEMBER_CURRENT_USER_CUSTOM);
  422. * </script>
  423. * ```
  424. *
  425. * @package s2Member\API_Constants
  426. * @since 3.5
  427. *
  428. * @var str
  429. *
  430. * @see s2Member\API_Functions\get_user_field()
  431. * @see `get_user_field("s2member_custom")`
  432. *
  433. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_ID
  434. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID
  435. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY
  436. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
  437. *
  438. * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
  439. * @see `get_user_option("s2member_custom")`
  440. */
  441. if (!defined ("S2MEMBER_CURRENT_USER_CUSTOM"))
  442. define ("S2MEMBER_CURRENT_USER_CUSTOM", ($c[] = (($user) ? (string)$custom : "")));
  443. /**
  444. * The current User's Registration Time.
  445. *
  446. * The Registration Time, is the time at which the Username was created for the account, that's it.
  447. * There's nothing special about this. This simply returns a {@link http://en.wikipedia.org/wiki/Unix_time Unix Timestamp}.
  448. *
  449. * This will be equal to `0` if NOT logged-in.
  450. *
  451. * ———— Quick PHP Code Sample ————
  452. * ```
  453. * <!php echo S2MEMBER_CURRENT_USER_REGISTRATION_TIME; !>
  454. * ```
  455. * ———— Shortcode & JavaScript Equivalents ————
  456. * ```
  457. * [s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_TIME" /]
  458. *
  459. * <script type="text/javascript">
  460. * document.write(S2MEMBER_CURRENT_USER_REGISTRATION_TIME);
  461. * </script>
  462. * ```
  463. *
  464. * @package s2Member\API_Constants
  465. * @since 3.5
  466. *
  467. * @var int
  468. *
  469. * @see s2Member\API_Functions\s2member_registration_time()
  470. *
  471. * @see s2Member\API_Functions\s2member_paid_registration_time()
  472. * @see `s2member_paid_registration_time("level1")`
  473. *
  474. * @see s2Member\API_Functions\get_user_field()
  475. *
  476. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_DAYS
  477. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME
  478. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS
  479. *
  480. * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
  481. */
  482. if (!defined ("S2MEMBER_CURRENT_USER_REGISTRATION_TIME"))
  483. define ("S2MEMBER_CURRENT_USER_REGISTRATION_TIME", ($c[] = (($user && $user->user_registered) ? (int)strtotime ($user->user_registered) : 0)));
  484. /**
  485. * The current User's first Paid Registration Time; regardless of which paid Level they gained access to.
  486. *
  487. * **NOTE** A Paid Registration Time, is NOT necessarily related specifically to a Payment.
  488. * s2Member records a Paid Registration Time, anytime a User acquires paid Membership Level Access.
  489. *
  490. * In other words, if you create a new User inside your Dashboard at a Membership Level greater than Level #0,
  491. * s2Member will record a Paid Registration Time immediately, because Membership Levels > 0, are reserved for paying Members.
  492. * s2Member monitors changes to all User accounts, and records the first Paid Registration Time for each Member, at each paid Membership Level.
  493. * So, s2Member stores the first Time a Member reaches each Level of paid access; and s2Member does NOT care if they *actually* paid, or not.
  494. *
  495. * If the current User has never been at a paid Membership Level, this will be equal to `0`.
  496. *
  497. * This will be equal to `0` if NOT logged-in.
  498. *
  499. * ———— Quick PHP Code Sample ————
  500. * ```
  501. * <!php echo S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME; !>
  502. * ```
  503. * ———— Shortcode & JavaScript Equivalents ————
  504. * ```
  505. * [s2Get constant="S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME" /]
  506. *
  507. * <script type="text/javascript">
  508. * document.write(S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME);
  509. * </script>
  510. * ```
  511. *
  512. * If you need to know the last time an actual payment was received, please use ``get_user_option ("s2member_last_payment_time")``.
  513. *
  514. * @package s2Member\API_Constants
  515. * @since 3.5
  516. *
  517. * @var int
  518. *
  519. * @see s2Member\API_Functions\s2member_registration_time()
  520. *
  521. * @see s2Member\API_Functions\s2member_paid_registration_time()
  522. * @see `s2member_paid_registration_time("level1")`
  523. *
  524. * @see s2Member\API_Functions\get_user_field()
  525. *
  526. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_TIME
  527. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_DAYS
  528. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS
  529. *
  530. * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
  531. */
  532. if (!defined ("S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME"))
  533. define ("S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME", ($c[] = (($user && (int)$paid_registration_times["level"]) ? (int)$paid_registration_times["level"] : 0)));
  534. /**
  535. * The number of days the current User has been a paid Member.
  536. *
  537. * **NOTE** This is calculated using the first Paid Registration Time.
  538. * A Paid Registration Time, is NOT necessarily related specifically to a Payment.
  539. * s2Member records a Paid Registration Time, anytime a User acquires paid Membership Level Access.
  540. *
  541. * In other words, if you create a new User inside your Dashboard at a Membership Level greater than Level #0,
  542. * s2Member will record a Paid Registration Time immediately, because Membership Levels > 0, are reserved for paying Members.
  543. * s2Member monitors changes to all User accounts, and records the first Paid Registration Time for each Member, at each paid Membership Level.
  544. * So, s2Member stores the first Time a Member reaches each Level of paid access; and s2Member does NOT care if they *actually* paid, or not.
  545. *
  546. * If the current User has never been at a paid Membership Level, this will be equal to `0`.
  547. *
  548. * This will be equal to `0` if NOT logged-in.
  549. *
  550. * ———— Quick PHP Code Sample ————
  551. * ```
  552. * <!php echo S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS; !>
  553. * ```
  554. * ———— Shortcode & JavaScript Equivalents ————
  555. * ```
  556. * [s2Get constant="S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS" /]
  557. *
  558. * <script type="text/javascript">
  559. * document.write(S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS);
  560. * </script>
  561. * ```
  562. *
  563. * If you need to know the last time an actual payment was received, please use ``get_user_option ("s2member_last_payment_time")``.
  564. *
  565. * @package s2Member\API_Constants
  566. * @since 3.5
  567. *
  568. * @var int
  569. *
  570. * @see s2Member\API_Functions\s2member_registration_time()
  571. *
  572. * @see s2Member\API_Functions\s2member_paid_registration_time()
  573. * @see `s2member_paid_registration_time("level1")`
  574. *
  575. * @see s2Member\API_Functions\get_user_field()
  576. *
  577. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_TIME
  578. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_DAYS
  579. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME
  580. *
  581. * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
  582. */
  583. if (!defined ("S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS"))
  584. define ("S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS", ($c[] = (($user && (int)$paid_registration_times["level"]) ? (int)floor ((strtotime ("now") - (int)$paid_registration_times["level"]) / 86400) : 0)));
  585. /**
  586. * The number of days the current User has had an account, period.
  587. *
  588. * **NOTE** This is calculated with Registration Time.
  589. * The Registration Time, is the time at which the Username was created for the account, that's it.
  590. *
  591. * This will be equal to `0` if NOT logged-in.
  592. *
  593. * ———— Quick PHP Code Sample ————
  594. * ```
  595. * <!php echo S2MEMBER_CURRENT_USER_REGISTRATION_DAYS; !>
  596. * ```
  597. * ———— Shortcode & JavaScript Equivalents ————
  598. * ```
  599. * [s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_DAYS" /]
  600. *
  601. * <script type="text/javascript">
  602. * document.write(S2MEMBER_CURRENT_USER_REGISTRATION_DAYS);
  603. * </script>
  604. * ```
  605. *
  606. * @package s2Member\API_Constants
  607. * @since 3.5
  608. *
  609. * @var int
  610. *
  611. * @see s2Member\API_Functions\s2member_registration_time()
  612. *
  613. * @see s2Member\API_Functions\s2member_paid_registration_time()
  614. * @see `s2member_paid_registration_time("level1")`
  615. *
  616. * @see s2Member\API_Functions\get_user_field()
  617. *
  618. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_TIME
  619. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME
  620. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS
  621. *
  622. * @see http://codex.wordpress.org/Function_Reference/get_user_option get_user_option()
  623. */
  624. if (!defined ("S2MEMBER_CURRENT_USER_REGISTRATION_DAYS"))
  625. define ("S2MEMBER_CURRENT_USER_REGISTRATION_DAYS", ($c[] = (($user && $user->user_registered) ? (int)floor ((strtotime ("now") - strtotime ($user->user_registered)) / 86400) : 0)));
  626. /**
  627. * The current User's Display Name.
  628. *
  629. * This is usually a name they prefer to be known by publicly.
  630. * Some Users/Members prefer to use their First Name as the Display Name, and keep their Last Name private.
  631. *
  632. * An empty string if NOT logged-in.
  633. *
  634. * ———— Quick PHP Code Sample ————
  635. * ```
  636. * <!php echo S2MEMBER_CURRENT_USER_DISPLAY_NAME; !>
  637. * ```
  638. * ———— Shortcode & JavaScript Equivalents ————
  639. * ```
  640. * [s2Get constant="S2MEMBER_CURRENT_USER_DISPLAY_NAME" /]
  641. *
  642. * <script type="text/javascript">
  643. * document.write(S2MEMBER_CURRENT_USER_DISPLAY_NAME);
  644. * </script>
  645. * ```
  646. *
  647. * @package s2Member\API_Constants
  648. * @since 3.5
  649. *
  650. * @var str
  651. *
  652. * @see s2Member\API_Functions\get_user_field()
  653. * @see `get_user_field("display_name")`
  654. *
  655. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
  656. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
  657. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
  658. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
  659. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
  660. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
  661. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
  662. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
  663. *
  664. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  665. */
  666. if (!defined ("S2MEMBER_CURRENT_USER_DISPLAY_NAME"))
  667. define ("S2MEMBER_CURRENT_USER_DISPLAY_NAME", ($c[] = (($user) ? (string)$user->display_name : "")));
  668. /**
  669. * The current User's First Name.
  670. *
  671. * An empty string if NOT logged-in.
  672. *
  673. * ———— Quick PHP Code Sample ————
  674. * ```
  675. * <!php echo S2MEMBER_CURRENT_USER_FIRST_NAME; !>
  676. * ```
  677. * ———— Shortcode & JavaScript Equivalents ————
  678. * ```
  679. * [s2Get constant="S2MEMBER_CURRENT_USER_FIRST_NAME" /]
  680. *
  681. * <script type="text/javascript">
  682. * document.write(S2MEMBER_CURRENT_USER_FIRST_NAME);
  683. * </script>
  684. * ```
  685. *
  686. * @package s2Member\API_Constants
  687. * @since 3.5
  688. *
  689. * @var str
  690. *
  691. * @see s2Member\API_Functions\get_user_field()
  692. * @see `get_user_field("first_name")`
  693. *
  694. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
  695. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
  696. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
  697. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
  698. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
  699. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
  700. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
  701. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
  702. *
  703. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  704. */
  705. if (!defined ("S2MEMBER_CURRENT_USER_FIRST_NAME"))
  706. define ("S2MEMBER_CURRENT_USER_FIRST_NAME", ($c[] = (($user) ? (string)$user->first_name : "")));
  707. /**
  708. * The current User's Last Name.
  709. *
  710. * An empty string if NOT logged-in.
  711. *
  712. * ———— Quick PHP Code Sample ————
  713. * ```
  714. * <!php echo S2MEMBER_CURRENT_USER_LAST_NAME; !>
  715. * ```
  716. * ———— Shortcode & JavaScript Equivalents ————
  717. * ```
  718. * [s2Get constant="S2MEMBER_CURRENT_USER_LAST_NAME" /]
  719. *
  720. * <script type="text/javascript">
  721. * document.write(S2MEMBER_CURRENT_USER_LAST_NAME);
  722. * </script>
  723. * ```
  724. *
  725. * @package s2Member\API_Constants
  726. * @since 3.5
  727. *
  728. * @var str
  729. *
  730. * @see s2Member\API_Functions\get_user_field()
  731. * @see `get_user_field("last_name")`
  732. *
  733. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
  734. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
  735. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
  736. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
  737. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
  738. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
  739. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
  740. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
  741. *
  742. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  743. */
  744. if (!defined ("S2MEMBER_CURRENT_USER_LAST_NAME"))
  745. define ("S2MEMBER_CURRENT_USER_LAST_NAME", ($c[] = (($user) ? (string)$user->last_name : "")));
  746. /**
  747. * The current User's Username.
  748. *
  749. * An empty string if NOT logged-in.
  750. *
  751. * ———— Quick PHP Code Sample ————
  752. * ```
  753. * <!php echo S2MEMBER_CURRENT_USER_LOGIN; !>
  754. * ```
  755. * ———— Shortcode & JavaScript Equivalents ————
  756. * ```
  757. * [s2Get constant="S2MEMBER_CURRENT_USER_LOGIN" /]
  758. *
  759. * <script type="text/javascript">
  760. * document.write(S2MEMBER_CURRENT_USER_LOGIN);
  761. * </script>
  762. * ```
  763. *
  764. * @package s2Member\API_Constants
  765. * @since 3.5
  766. *
  767. * @var str
  768. *
  769. * @see s2Member\API_Functions\get_user_field()
  770. * @see `get_user_field("user_login")`
  771. *
  772. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
  773. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
  774. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
  775. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
  776. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
  777. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
  778. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
  779. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
  780. *
  781. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  782. */
  783. if (!defined ("S2MEMBER_CURRENT_USER_LOGIN"))
  784. define ("S2MEMBER_CURRENT_USER_LOGIN", ($c[] = (($user) ? (string)$user->user_login : "")));
  785. /**
  786. * The current User's Email Address.
  787. *
  788. * An empty string if NOT logged-in.
  789. *
  790. * ———— Quick PHP Code Sample ————
  791. * ```
  792. * <!php echo S2MEMBER_CURRENT_USER_EMAIL; !>
  793. * ```
  794. * ———— Shortcode & JavaScript Equivalents ————
  795. * ```
  796. * [s2Get constant="S2MEMBER_CURRENT_USER_EMAIL" /]
  797. *
  798. * <script type="text/javascript">
  799. * document.write(S2MEMBER_CURRENT_USER_EMAIL);
  800. * </script>
  801. * ```
  802. *
  803. * @package s2Member\API_Constants
  804. * @since 3.5
  805. *
  806. * @var str
  807. *
  808. * @see s2Member\API_Functions\get_user_field()
  809. * @see `get_user_field("user_email")`
  810. *
  811. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
  812. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
  813. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
  814. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
  815. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
  816. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
  817. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
  818. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
  819. *
  820. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  821. */
  822. if (!defined ("S2MEMBER_CURRENT_USER_EMAIL"))
  823. define ("S2MEMBER_CURRENT_USER_EMAIL", ($c[] = (($user) ? (string)$user->user_email : "")));
  824. /**
  825. * The current User's IP Address (even if/when NOT logged-in).
  826. *
  827. * This is the current IP Address, taken from ``$_SERVER["REMOTE_ADDR"]``.
  828. *
  829. * ———— Quick PHP Code Sample ————
  830. * ```
  831. * <!php echo S2MEMBER_CURRENT_USER_IP; !>
  832. * ```
  833. * ———— Shortcode & JavaScript Equivalents ————
  834. * ```
  835. * [s2Get constant="S2MEMBER_CURRENT_USER_IP" /]
  836. *
  837. * <script type="text/javascript">
  838. * document.write(S2MEMBER_CURRENT_USER_IP);
  839. * </script>
  840. * ```
  841. *
  842. * @package s2Member\API_Constants
  843. * @since 3.5
  844. *
  845. * @var str
  846. *
  847. * @see s2Member\API_Functions\get_user_field()
  848. * @see `get_user_field("s2member_registration_ip")`
  849. * @see `get_user_field("ip")`
  850. *
  851. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
  852. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
  853. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
  854. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
  855. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
  856. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
  857. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
  858. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
  859. *
  860. * @see http://www.php.net/manual/en/reserved.variables.server.php Superglobal $_SERVER
  861. * @see `$_SERVER["REMOTE_ADDR"]`
  862. */
  863. if (!defined ("S2MEMBER_CURRENT_USER_IP"))
  864. define ("S2MEMBER_CURRENT_USER_IP", ($c[] = (string)$_SERVER["REMOTE_ADDR"]));
  865. /**
  866. * IP Address the current User had during registration.
  867. *
  868. * This is the IP Address the User had at the time they registered.
  869. * It's useful when you need to know the original IP Address they used.
  870. * For instance, this is needed by some affiliate tracking systems; such as iDevAffiliate.
  871. *
  872. * An empty string if NOT logged-in.
  873. *
  874. * ———— Quick PHP Code Sample ————
  875. * ```
  876. * <!php echo S2MEMBER_CURRENT_USER_REGISTRATION_IP; !>
  877. * ```
  878. * ———— Shortcode & JavaScript Equivalents ————
  879. * ```
  880. * [s2Get constant="S2MEMBER_CURRENT_USER_REGISTRATION_IP" /]
  881. *
  882. * <script type="text/javascript">
  883. * document.write(S2MEMBER_CURRENT_USER_REGISTRATION_IP);
  884. * </script>
  885. * ```
  886. *
  887. * @package s2Member\API_Constants
  888. * @since 3.5
  889. *
  890. * @var str
  891. *
  892. * @see s2Member\API_Functions\get_user_field()
  893. * @see `get_user_field("s2member_registration_ip")`
  894. * @see `get_user_field("ip")`
  895. *
  896. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
  897. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID
  898. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
  899. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
  900. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
  901. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
  902. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
  903. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
  904. *
  905. * @see http://www.php.net/manual/en/reserved.variables.server.php Superglobal $_SERVER
  906. * @see `$_SERVER["REMOTE_ADDR"]`
  907. */
  908. if (!defined ("S2MEMBER_CURRENT_USER_REGISTRATION_IP"))
  909. define ("S2MEMBER_CURRENT_USER_REGISTRATION_IP", ($c[] = (($user) ? (string)$registration_ip : "")));
  910. /**
  911. * The current User's WordPress® User ID.
  912. *
  913. * This will be equal to `0` if NOT logged-in.
  914. *
  915. * ———— Quick PHP Code Sample ————
  916. * ```
  917. * <!php echo S2MEMBER_CURRENT_USER_ID; !>
  918. * ```
  919. * ———— Shortcode & JavaScript Equivalents ————
  920. * ```
  921. * [s2Get constant="S2MEMBER_CURRENT_USER_ID" /]
  922. *
  923. * <script type="text/javascript">
  924. * document.write(S2MEMBER_CURRENT_USER_ID);
  925. * </script>
  926. * ```
  927. *
  928. * @package s2Member\API_Constants
  929. * @since 3.5
  930. *
  931. * @var int
  932. *
  933. * @see s2Member\API_Functions\get_user_field()
  934. * @see `get_user_field("id")`
  935. *
  936. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP
  937. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP
  938. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN
  939. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL
  940. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME
  941. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME
  942. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME
  943. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIELDS
  944. *
  945. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  946. */
  947. if (!defined ("S2MEMBER_CURRENT_USER_ID"))
  948. define ("S2MEMBER_CURRENT_USER_ID", ($c[] = (($user) ? (int)$user->ID : 0)));
  949. /**
  950. * The current User's fields, provided by s2Member.
  951. *
  952. * This holds a JSON-encoded array, containing these array keys:
  953. *
  954. * o `id` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_ID}
  955. * o `ip` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_IP}
  956. * o `reg_ip` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_REGISTRATION_IP}
  957. * o `email` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_EMAIL}
  958. * o `login` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_LOGIN}
  959. * o `first_name` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_FIRST_NAME}
  960. * o `last_name` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_LAST_NAME}
  961. * o `display_name` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_DISPLAY_NAME}
  962. * o `subscr_id` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_ID}
  963. * o `subscr_or_wp_id` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID}
  964. * o `subscr_gateway` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY}
  965. * o `custom` = value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_CUSTOM}
  966. * o and any Custom Registration/Profile Fields configured by the site owner.
  967. *
  968. * This will be an empty JSON-encoded array if NOT logged-in.
  969. *
  970. * ———— Code Sample ( Using ``json_decode(JSON, true)`` ) ————
  971. * ```
  972. * <!php
  973. * $fields = json_decode(S2MEMBER_CURRENT_USER_FIELDS, true);
  974. * echo $fields["email"]; # The current User's Email Address.
  975. * echo $fields["my_unique_field_id"]; # A Custom Registration/Profile Field configured by the site owner.
  976. * !>
  977. * ```
  978. * ———— Shortcode & JavaScript Equivalents ————
  979. * ```
  980. * [s2Get user_field="id" /]
  981. * [s2Get user_field="ip" /]
  982. * [s2Get user_field="reg_ip" /]
  983. * [s2Get user_field="email" /]
  984. * [s2Get user_field="login" /]
  985. * [s2Get user_field="first_name" /]
  986. * [s2Get user_field="last_name" /]
  987. * [s2Get user_field="display_name" /]
  988. * [s2Get user_field="s2member_subscr_id" /]
  989. * [s2Get user_field="s2member_subscr_wp_id" /]
  990. * [s2Get user_field="s2member_subscr_gateway" /]
  991. * [s2Get user_field="s2member_custom" /]
  992. * [s2Get user_field="my_custom_field_id" /]
  993. *
  994. * <script type="text/javascript">
  995. * document.write(S2MEMBER_CURRENT_USER_FIELDS.id);
  996. * document.write(S2MEMBER_CURRENT_USER_FIELDS.display_name);
  997. * </script>
  998. * ```
  999. *
  1000. * @package s2Member\API_Constants
  1001. * @since 3.5
  1002. *
  1003. * @var str
  1004. *
  1005. * @see s2Member\API_Functions\get_user_field()
  1006. *
  1007. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  1008. */
  1009. if (!defined ("S2MEMBER_CURRENT_USER_FIELDS"))
  1010. define ("S2MEMBER_CURRENT_USER_FIELDS", ($c[] = (($user) ? json_encode (array_merge (array ("id" => S2MEMBER_CURRENT_USER_ID, "ip" => S2MEMBER_CURRENT_USER_IP, "reg_ip" => S2MEMBER_CURRENT_USER_REGISTRATION_IP, "email" => S2MEMBER_CURRENT_USER_EMAIL, "login" => S2MEMBER_CURRENT_USER_LOGIN, "first_name" => S2MEMBER_CURRENT_USER_FIRST_NAME, "last_name" => S2MEMBER_CURRENT_USER_LAST_NAME, "display_name" => S2MEMBER_CURRENT_USER_DISPLAY_NAME, "subscr_id" => S2MEMBER_CURRENT_USER_SUBSCR_ID, "subscr_or_wp_id" => S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID, "subscr_gateway" => S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY, "custom" => S2MEMBER_CURRENT_USER_CUSTOM), (array)$custom_fields)) : json_encode (array ()))));
  1011. /**
  1012. * Indicates the number of unique Files the current User is allowed to download every X days.
  1013. *
  1014. * `0` means no access to File Downloads has been made available to the User.
  1015. *
  1016. * This will be equal to `0` if NOT logged-in.
  1017. *
  1018. * ———— Quick PHP Code Sample ————
  1019. * ```
  1020. * <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED; !>
  1021. * ```
  1022. * ———— Shortcode & JavaScript Equivalents ————
  1023. * ```
  1024. * [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED" /]
  1025. *
  1026. * <script type="text/javascript">
  1027. * document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED);
  1028. * </script>
  1029. * ```
  1030. *
  1031. * @package s2Member\API_Constants
  1032. * @since 3.5
  1033. *
  1034. * @var int
  1035. *
  1036. * @see s2Member\API_Functions\s2member_user_downloads()
  1037. * @see s2Member\API_Functions\s2member_total_downloads_of()
  1038. * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
  1039. *
  1040. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
  1041. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
  1042. *
  1043. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
  1044. *
  1045. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1046. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1047. *
  1048. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
  1049. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
  1050. *
  1051. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
  1052. *
  1053. * @see `Dashboard -› s2Member -› Download Options`
  1054. */
  1055. if (!defined ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED"))
  1056. define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED", ($c[] = (int)$file_downloads["allowed"]));
  1057. /**
  1058. * Does the current User have access to unlimited File Downloads.
  1059. *
  1060. * A value of true means the current User's allowed downloads are >= `999999999`, and false means it is not.
  1061. * This is useful if you are allowing unlimited ( i.e. `999999999+` ) Downloads on some Membership Levels.
  1062. * You can display `Unlimited` instead of a numerical value.
  1063. *
  1064. * This will be false if NOT logged-in.
  1065. *
  1066. * ———— Quick PHP Code Sample ————
  1067. * ```
  1068. * <!php
  1069. * if(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)
  1070. * echo 'You have access to unlimited downloads.';
  1071. * !>
  1072. * ```
  1073. * ———— Shortcode & JavaScript Equivalents ————
  1074. * ```
  1075. * [s2If constant(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)]
  1076. * You have access to unlimited downloads.
  1077. * [/s2If]
  1078. *
  1079. * <script type="text/javascript">
  1080. * if(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)
  1081. * document.write('You have access to unlimited downloads.');
  1082. * </script>
  1083. * ```
  1084. *
  1085. * @package s2Member\API_Constants
  1086. * @since 3.5
  1087. *
  1088. * @var bool
  1089. *
  1090. * @see s2Member\API_Functions\s2member_user_downloads()
  1091. * @see s2Member\API_Functions\s2member_total_downloads_of()
  1092. * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
  1093. *
  1094. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
  1095. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
  1096. *
  1097. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
  1098. *
  1099. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1100. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1101. *
  1102. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
  1103. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
  1104. *
  1105. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
  1106. *
  1107. * @see `Dashboard -› s2Member -› Download Options`
  1108. */
  1109. if (!defined ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED"))
  1110. define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED", ($c[] = (($file_downloads["allowed"] >= 999999999) ? true : false)));
  1111. /**
  1112. * Indicates the number of unique Files the current User has downloaded in the last X days.
  1113. *
  1114. * This will be equal to `0` if NOT logged-in.
  1115. *
  1116. * ———— Quick PHP Code Sample ————
  1117. * ```
  1118. * <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY; !>
  1119. * ```
  1120. * ———— Shortcode & JavaScript Equivalents ————
  1121. * ```
  1122. * [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY" /]
  1123. *
  1124. * <script type="text/javascript">
  1125. * document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY);
  1126. * </script>
  1127. * ```
  1128. *
  1129. * @package s2Member\API_Constants
  1130. * @since 3.5
  1131. *
  1132. * @var int
  1133. *
  1134. * @note This does NOT include File Downloads accessed with an Advanced File Download Key.
  1135. *
  1136. * @see s2Member\API_Functions\s2member_user_downloads()
  1137. * @see s2Member\API_Functions\s2member_total_downloads_of()
  1138. * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
  1139. *
  1140. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
  1141. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
  1142. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
  1143. *
  1144. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1145. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1146. *
  1147. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
  1148. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
  1149. *
  1150. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
  1151. *
  1152. * @see `Dashboard -› s2Member -› Download Options`
  1153. */
  1154. if (!defined ("S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY"))
  1155. define ("S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY", ($c[] = (int)$file_downloads["currently"]));
  1156. /**
  1157. * Indicates the X number of days, configured by the site owner; for the current User.
  1158. *
  1159. * This will be equal to `0` if NOT logged-in.
  1160. *
  1161. * ———— Quick PHP Code Sample ————
  1162. * ```
  1163. * You are allowed to download <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED; !> files, every <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS; !> days.
  1164. * You've downloaded <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY; !> files in the last <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS; !> days.
  1165. * ```
  1166. * ———— Shortcode & JavaScript Equivalents ————
  1167. * ```
  1168. * You are allowed to download [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED" /] files, every [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS" /] days.
  1169. * You've downloaded [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY" /] files in the last [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS" /] days.
  1170. *
  1171. * You are allowed to download <script type="text/javascript">document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED);</script> files, every <script type="text/javascript">document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS);</script> days.
  1172. * You've downloaded <script type="text/javascript">document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY);</script> files in the last <script type="text/javascript">document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS);</script> days.
  1173. * ```
  1174. *
  1175. * @package s2Member\API_Constants
  1176. * @since 3.5
  1177. *
  1178. * @var int
  1179. *
  1180. * @see s2Member\API_Functions\s2member_user_downloads()
  1181. * @see s2Member\API_Functions\s2member_total_downloads_of()
  1182. * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
  1183. *
  1184. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
  1185. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
  1186. *
  1187. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
  1188. *
  1189. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1190. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1191. *
  1192. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
  1193. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
  1194. *
  1195. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
  1196. *
  1197. * @see `Dashboard -› s2Member -› Download Options`
  1198. */
  1199. if (!defined ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS"))
  1200. define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS", ($c[] = (int)$file_downloads["allowed_days"]));
  1201. /**
  1202. * The configured Page ID, for the Download Limit Exceeded Page.
  1203. *
  1204. * This will be equal to `0` if NOT yet configured.
  1205. *
  1206. * ———— Quick PHP Code Sample ————
  1207. * ```
  1208. * <!php echo S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID; !>
  1209. * ```
  1210. * ———— Shortcode & JavaScript Equivalents ————
  1211. * ```
  1212. * [s2Get constant="S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID" /]
  1213. *
  1214. * <script type="text/javascript">
  1215. * document.write(S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID);
  1216. * </script>
  1217. * ```
  1218. *
  1219. * @package s2Member\API_Constants
  1220. * @since 3.5
  1221. *
  1222. * @var int
  1223. *
  1224. * @see s2Member\API_Functions\s2member_user_downloads()
  1225. * @see s2Member\API_Functions\s2member_total_downloads_of()
  1226. * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
  1227. *
  1228. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
  1229. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
  1230. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
  1231. *
  1232. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
  1233. *
  1234. * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
  1235. * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
  1236. *
  1237. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
  1238. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
  1239. *
  1240. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
  1241. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
  1242. *
  1243. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1244. *
  1245. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
  1246. *
  1247. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
  1248. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
  1249. *
  1250. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
  1251. *
  1252. * @see `Dashboard -› s2Member -› Download Options`
  1253. */
  1254. if (!defined ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID"))
  1255. define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]));
  1256. /**
  1257. * The configured Page ID, for the Membership Options Page.
  1258. *
  1259. * This will be equal to `0` if NOT yet configured.
  1260. *
  1261. * ———— Quick PHP Code Sample ————
  1262. * ```
  1263. * <!php echo S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID; !>
  1264. * ```
  1265. * ———— Shortcode & JavaScript Equivalents ————
  1266. * ```
  1267. * [s2Get constant="S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID" /]
  1268. *
  1269. * <script type="text/javascript">
  1270. * document.write(S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID);
  1271. * </script>
  1272. * ```
  1273. *
  1274. * @package s2Member\API_Constants
  1275. * @since 3.5
  1276. *
  1277. * @var int
  1278. *
  1279. * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
  1280. * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
  1281. *
  1282. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
  1283. *
  1284. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
  1285. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
  1286. *
  1287. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1288. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1289. *
  1290. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
  1291. *
  1292. * @see `Dashboard -› s2Member -› General Options -› Membership Options Page`
  1293. */
  1294. if (!defined ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID"))
  1295. define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]));
  1296. /**
  1297. * The configured Page ID, for the Login Welcome Page.
  1298. *
  1299. * This will be equal to `0` if NOT yet configured.
  1300. *
  1301. * ———— Quick PHP Code Sample ————
  1302. * ```
  1303. * <!php echo S2MEMBER_LOGIN_WELCOME_PAGE_ID; !>
  1304. * ```
  1305. * ———— Shortcode & JavaScript Equivalents ————
  1306. * ```
  1307. * [s2Get constant="S2MEMBER_LOGIN_WELCOME_PAGE_ID" /]
  1308. *
  1309. * <script type="text/javascript">
  1310. * document.write(S2MEMBER_LOGIN_WELCOME_PAGE_ID);
  1311. * </script>
  1312. * ```
  1313. *
  1314. * @package s2Member\API_Constants
  1315. * @since 3.5
  1316. *
  1317. * @var int
  1318. *
  1319. * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
  1320. * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
  1321. *
  1322. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
  1323. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
  1324. *
  1325. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
  1326. *
  1327. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1328. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1329. *
  1330. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
  1331. *
  1332. * @see `Dashboard -› s2Member -› General Options -› Login Welcome Page`
  1333. */
  1334. if (!defined ("S2MEMBER_LOGIN_WELCOME_PAGE_ID"))
  1335. define ("S2MEMBER_LOGIN_WELCOME_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
  1336. /**
  1337. * A URL, which leads to the Stand-Alone Profile Modification Page.
  1338. *
  1339. * This is always a reference to `/?s2member_profile=1` *(i.e. the Stand-Alone version)*.
  1340. *
  1341. * ———— Quick PHP Code Sample ————
  1342. * ```
  1343. * <!php echo S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL; !>
  1344. * ```
  1345. * ———— Shortcode & JavaScript Equivalents ————
  1346. * ```
  1347. * [s2Get constant="S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL" /]
  1348. *
  1349. * <script type="text/javascript">
  1350. * document.write(S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL);
  1351. * </script>
  1352. * ```
  1353. *
  1354. * @package s2Member\API_Constants
  1355. * @since 3.5
  1356. *
  1357. * @var str
  1358. *
  1359. * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
  1360. * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
  1361. *
  1362. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
  1363. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
  1364. *
  1365. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
  1366. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
  1367. *
  1368. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1369. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1370. *
  1371. * @see `Dashboard -› s2Member -› General Options -› Profile Modifications`
  1372. */
  1373. if (!defined ("S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL"))
  1374. define ("S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL", ($c[] = (string)site_url ("/?s2member_profile=1")));
  1375. /**
  1376. * A URL, which leads to the Download Limit Exceeded Page; as configured by the site owner.
  1377. *
  1378. * If the site owner has not yet configured a Download Limit Exceeded Page, this defaults to the Home Page.
  1379. *
  1380. * ———— Quick PHP Code Sample ————
  1381. * ```
  1382. * <!php echo S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL; !>
  1383. * ```
  1384. * ———— Shortcode & JavaScript Equivalents ————
  1385. * ```
  1386. * [s2Get constant="S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL" /]
  1387. *
  1388. * <script type="text/javascript">
  1389. * document.write(S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL);
  1390. * </script>
  1391. * ```
  1392. *
  1393. * @package s2Member\API_Constants
  1394. * @since 3.5
  1395. *
  1396. * @var str
  1397. *
  1398. * @see s2Member\API_Functions\s2member_user_downloads()
  1399. * @see s2Member\API_Functions\s2member_total_downloads_of()
  1400. * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
  1401. *
  1402. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
  1403. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
  1404. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
  1405. *
  1406. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
  1407. *
  1408. * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
  1409. * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
  1410. *
  1411. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
  1412. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
  1413. *
  1414. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
  1415. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
  1416. *
  1417. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1418. *
  1419. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
  1420. *
  1421. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
  1422. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
  1423. *
  1424. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
  1425. *
  1426. * @see `Dashboard -› s2Member -› Download Options`
  1427. */
  1428. if (!defined ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL"))
  1429. define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL", ($c[] = (string)$links["file_download_limit_exceeded_page"]));
  1430. /**
  1431. * A URL, which leads to the Membership Options Page; as configured by the site owner.
  1432. *
  1433. * If the site owner has not yet configured a Membership Options Page, this defaults to the Home Page.
  1434. *
  1435. * ———— Quick PHP Code Sample ————
  1436. * ```
  1437. * <!php echo S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL; !>
  1438. * ```
  1439. * ———— Shortcode & JavaScript Equivalents ————
  1440. * ```
  1441. * [s2Get constant="S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL" /]
  1442. *
  1443. * <script type="text/javascript">
  1444. * document.write(S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
  1445. * </script>
  1446. * ```
  1447. *
  1448. * @package s2Member\API_Constants
  1449. * @since 3.5
  1450. *
  1451. * @var str
  1452. *
  1453. * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
  1454. * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
  1455. *
  1456. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
  1457. *
  1458. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
  1459. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
  1460. *
  1461. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1462. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1463. *
  1464. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
  1465. *
  1466. * @see `Dashboard -› s2Member -› General Options -› Membership Options Page`
  1467. */
  1468. if (!defined ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL"))
  1469. define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL", ($c[] = (string)$links["membership_options_page"])); // Signup page.
  1470. /**
  1471. * The URL, which leads to the Login Welcome Page; as configured by the site owner.
  1472. *
  1473. * If the site owner has not yet configured a Login Welcome Page, this defaults to the Home Page.
  1474. *
  1475. * ———— Quick PHP Code Sample ————
  1476. * ```
  1477. * <!php echo S2MEMBER_LOGIN_WELCOME_PAGE_URL; !>
  1478. * ```
  1479. * ———— Shortcode & JavaScript Equivalents ————
  1480. * ```
  1481. * [s2Get constant="S2MEMBER_LOGIN_WELCOME_PAGE_URL" /]
  1482. *
  1483. * <script type="text/javascript">
  1484. * document.write(S2MEMBER_LOGIN_WELCOME_PAGE_URL);
  1485. * </script>
  1486. * ```
  1487. *
  1488. * @package s2Member\API_Constants
  1489. * @since 3.5
  1490. *
  1491. * @var str
  1492. *
  1493. * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
  1494. * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
  1495. *
  1496. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
  1497. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
  1498. *
  1499. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
  1500. *
  1501. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1502. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1503. *
  1504. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
  1505. *
  1506. * @see `Dashboard -› s2Member -› General Options -› Login Welcome Page`
  1507. */
  1508. if (!defined ("S2MEMBER_LOGIN_WELCOME_PAGE_URL"))
  1509. define ("S2MEMBER_LOGIN_WELCOME_PAGE_URL", ($c[] = (($login_redirection_url) ? (string)$login_redirection_url : (string)$links["login_welcome_page"])));
  1510. /**
  1511. * The URL, which logs the current User out of their account.
  1512. *
  1513. * This is the value provided by WordPress®. It's the same as using ``wp_logout_url()``.
  1514. *
  1515. * ———— Quick PHP Code Sample ————
  1516. * ```
  1517. * <!php echo S2MEMBER_LOGOUT_PAGE_URL; !>
  1518. * ```
  1519. * ———— Shortcode & JavaScript Equivalents ————
  1520. * ```
  1521. * [s2Get constant="S2MEMBER_LOGOUT_PAGE_URL" /]
  1522. *
  1523. * <script type="text/javascript">
  1524. * document.write(S2MEMBER_LOGOUT_PAGE_URL);
  1525. * </script>
  1526. * ```
  1527. *
  1528. * @package s2Member\API_Constants
  1529. * @since 3.5
  1530. *
  1531. * @var str
  1532. *
  1533. * @see s2Member\API_Constants\S2MEMBER_LOGIN_PAGE_URL
  1534. *
  1535. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
  1536. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
  1537. *
  1538. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
  1539. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
  1540. *
  1541. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1542. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1543. *
  1544. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
  1545. *
  1546. * @see http://codex.wordpress.org/Function_Reference/wp_logout_url wp_logout_url()
  1547. */
  1548. if (!defined ("S2MEMBER_LOGOUT_PAGE_URL"))
  1549. define ("S2MEMBER_LOGOUT_PAGE_URL", ($c[] = (string)wp_logout_url ())); // This triggers `wp_nonce_tick()`; watch out for dynamic changes.
  1550. /**
  1551. * The URL, where a User can log into their account.
  1552. *
  1553. * This is the value provided by WordPress®. It's the same as using ``wp_login_url()``.
  1554. *
  1555. * ———— Quick PHP Code Sample ————
  1556. * ```
  1557. * <!php echo S2MEMBER_LOGIN_PAGE_URL; !>
  1558. * ```
  1559. * ———— Shortcode & JavaScript Equivalents ————
  1560. * ```
  1561. * [s2Get constant="S2MEMBER_LOGIN_PAGE_URL" /]
  1562. *
  1563. * <script type="text/javascript">
  1564. * document.write(S2MEMBER_LOGIN_PAGE_URL);
  1565. * </script>
  1566. * ```
  1567. *
  1568. * @package s2Member\API_Constants
  1569. * @since 3.5
  1570. *
  1571. * @var str
  1572. *
  1573. * @see s2Member\API_Constants\S2MEMBER_LOGOUT_PAGE_URL
  1574. *
  1575. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID
  1576. * @see s2Member\API_Constants\S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL
  1577. *
  1578. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_ID
  1579. * @see s2Member\API_Constants\S2MEMBER_LOGIN_WELCOME_PAGE_URL
  1580. *
  1581. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1582. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1583. *
  1584. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
  1585. *
  1586. * @see http://codex.wordpress.org/Function_Reference/wp_login_url wp_login_url()
  1587. */
  1588. if (!defined ("S2MEMBER_LOGIN_PAGE_URL"))
  1589. define ("S2MEMBER_LOGIN_PAGE_URL", ($c[] = (string)wp_login_url /* Will not trigger `wp_nonce_tick()`, no worries in this case. */ ()));
  1590. /**
  1591. * Each Membership Level (Label); as configured by the site owner.
  1592. *
  1593. * The defaults are as follows:
  1594. * o Level #0 ``S2MEMBER_LEVEL0_LABEL`` = Free Subscriber
  1595. * o Level #1 ``S2MEMBER_LEVEL1_LABEL`` = Bronze Member
  1596. * o Level #2 ``S2MEMBER_LEVEL2_LABEL`` = Silver Member
  1597. * o Level #3 ``S2MEMBER_LEVEL3_LABEL`` = Gold Member
  1598. * o Level #4 ``S2MEMBER_LEVEL4_LABEL`` = Platinum Member
  1599. *
  1600. * ———— Quick PHP Code Sample ————
  1601. * ```
  1602. * <!php echo S2MEMBER_LEVEL0_LABEL; !>
  1603. * ```
  1604. * ———— Shortcode & JavaScript Equivalents ————
  1605. * ```
  1606. * [s2Get constant="S2MEMBER_LEVEL0_LABEL" /]
  1607. *
  1608. * <script type="text/javascript">
  1609. * document.write(S2MEMBER_LEVEL0_LABEL);
  1610. * </script>
  1611. * ```
  1612. *
  1613. * @package s2Member\API_Constants
  1614. * @since 3.5
  1615. *
  1616. * @var str
  1617. *
  1618. * @see s2Member\API_Functions\get_user_field()
  1619. * @see `get_user_field("s2member_access_role")`
  1620. * @see `get_user_field("s2member_access_level")`
  1621. * @see `get_user_field("s2member_access_label")`
  1622. *
  1623. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ACCESS_LEVEL
  1624. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_ACCESS_LABEL
  1625. *
  1626. * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
  1627. *
  1628. * @see `Dashboard -› s2Member -› General Options -› Membership Level (Labels)`
  1629. */
  1630. for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
  1631. {
  1632. if (!defined (($S2MEMBER_LEVELn_LABEL = "S2MEMBER_LEVEL" . $n . "_LABEL")))
  1633. define ($S2MEMBER_LEVELn_LABEL, ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_label"]));
  1634. }
  1635. /**
  1636. * File Downloads allowed at each Membership Level; as configured by the site owner.
  1637. *
  1638. * The defaults are as follows:
  1639. * o Level #0 ``S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED`` = `0`
  1640. * o Level #1 ``S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED`` = `0`
  1641. * o Level #2 ``S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED`` = `0`
  1642. * o Level #3 ``S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED`` = `0`
  1643. * o Level #4 ``S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED`` = `0`
  1644. *
  1645. * ———— Quick PHP Code Sample ————
  1646. * ```
  1647. * <!php echo S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED; !>
  1648. * ```
  1649. * ———— Shortcode & JavaScript Equivalents ————
  1650. * ```
  1651. * [s2Get constant="S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED" /]
  1652. *
  1653. * <script type="text/javascript">
  1654. * document.write(S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED);
  1655. * </script>
  1656. * ```
  1657. *
  1658. * @package s2Member\API_Constants
  1659. * @since 3.5
  1660. *
  1661. * @var int
  1662. *
  1663. * @see s2Member\API_Functions\s2member_user_downloads()
  1664. * @see s2Member\API_Functions\s2member_total_downloads_of()
  1665. * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
  1666. *
  1667. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
  1668. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
  1669. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
  1670. *
  1671. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
  1672. *
  1673. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1674. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1675. *
  1676. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
  1677. *
  1678. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
  1679. *
  1680. * @see `Dashboard -› s2Member -› Download Options`
  1681. */
  1682. for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
  1683. {
  1684. if (!defined (($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED = "S2MEMBER_LEVEL" . $n . "_FILE_DOWNLOADS_ALLOWED")))
  1685. define ($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED, ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_file_downloads_allowed"]));
  1686. }
  1687. /**
  1688. * File Download days, at each Membership Level; as configured by the site owner.
  1689. *
  1690. * The defaults are as follows:
  1691. * o Level #0 ``S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
  1692. * o Level #1 ``S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
  1693. * o Level #2 ``S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
  1694. * o Level #3 ``S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
  1695. * o Level #4 ``S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS`` = `0`
  1696. *
  1697. * ———— Quick PHP Code Sample ————
  1698. * ```
  1699. * At Level #1, Members are allowed to download <!php echo S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED; !> files, every <!php echo S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS; !> days.
  1700. * You are currently at Membership Level #<!php echo S2MEMBER_CURRENT_USER_ACCESS_LEVEL; !>. You've downloaded <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY; !> files in the last <!php echo S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS; !> days.
  1701. * ```
  1702. * ———— Shortcode & JavaScript Equivalents ————
  1703. * ```
  1704. * At Level #1, Members are allowed to download [s2Get constant="S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED" /] files, every [s2Get constant="S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS" /] days.
  1705. * You are currently at Membership Level #[s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LEVEL" /]. You've downloaded [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY" /] files in the last [s2Get constant="S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS" /] days.
  1706. *
  1707. * At Level #1, Members are allowed to download <script type="text/javascript">document.write(S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED);</script> files, every <script type="text/javascript">document.write(S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS);</script> days.
  1708. * You are currently at Membership Level #<script type="text/javascript">document.write(S2MEMBER_CURRENT_USER_ACCESS_LEVEL);</script>. You've downloaded <script type="text/javascript">document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY);</script> files in the last <script type="text/javascript">document.write(S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS);</script> days.
  1709. * ```
  1710. *
  1711. * @package s2Member\API_Constants
  1712. * @since 3.5
  1713. *
  1714. * @var int
  1715. *
  1716. * @see s2Member\API_Functions\s2member_user_downloads()
  1717. * @see s2Member\API_Functions\s2member_total_downloads_of()
  1718. * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
  1719. *
  1720. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
  1721. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
  1722. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
  1723. *
  1724. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
  1725. *
  1726. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1727. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1728. *
  1729. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
  1730. *
  1731. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
  1732. *
  1733. * @see `Dashboard -› s2Member -› Download Options`
  1734. */
  1735. for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
  1736. {
  1737. if (!defined (($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS = "S2MEMBER_LEVEL" . $n . "_FILE_DOWNLOADS_ALLOWED_DAYS")))
  1738. define ($S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS, ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_file_downloads_allowed_days"]));
  1739. }
  1740. /**
  1741. * Inline File Download extensions; as configured by the site owner.
  1742. *
  1743. * ———— Quick PHP Code Sample ————
  1744. * ```
  1745. * <!php echo S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS; !>
  1746. * ```
  1747. * ———— Shortcode & JavaScript Equivalents ————
  1748. * ```
  1749. * [s2Get constant="S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS" /]
  1750. *
  1751. * <script type="text/javascript">
  1752. * document.write(S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS);
  1753. * </script>
  1754. * ```
  1755. *
  1756. * @package s2Member\API_Constants
  1757. * @since 3.5
  1758. *
  1759. * @var str
  1760. *
  1761. * @see s2Member\API_Functions\s2member_user_downloads()
  1762. * @see s2Member\API_Functions\s2member_total_downloads_of()
  1763. * @see s2Member\API_Functions\s2member_total_unique_downloads_of()
  1764. *
  1765. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED
  1766. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED
  1767. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS
  1768. *
  1769. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY
  1770. *
  1771. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
  1772. * @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
  1773. *
  1774. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
  1775. * @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
  1776. *
  1777. * @see `Dashboard -› s2Member -› Download Options`
  1778. */
  1779. if (!defined ("S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS"))
  1780. define ("S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]));
  1781. /**
  1782. * From: Name, for s2Member-specific emails; as configured by the site owner.
  1783. *
  1784. * ———— Quick PHP Code Sample ————
  1785. * ```
  1786. * <!php echo S2MEMBER_REG_EMAIL_FROM_NAME; !>
  1787. * ```
  1788. * ———— Shortcode & JavaScript Equivalents ————
  1789. * ```
  1790. * [s2Get constant="S2MEMBER_REG_EMAIL_FROM_NAME" /]
  1791. *
  1792. * <script type="text/javascript">
  1793. * document.write(S2MEMBER_REG_EMAIL_FROM_NAME);
  1794. * </script>
  1795. * ```
  1796. *
  1797. * @package s2Member\API_Constants
  1798. * @since 3.5
  1799. *
  1800. * @var str
  1801. *
  1802. * @see s2Member\API_Constants\S2MEMBER_REG_EMAIL_FROM_EMAIL
  1803. *
  1804. * @see `Dashboard -› s2Member -› General Options`
  1805. */
  1806. if (!defined ("S2MEMBER_REG_EMAIL_FROM_NAME"))
  1807. define ("S2MEMBER_REG_EMAIL_FROM_NAME", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]));
  1808. /**
  1809. * From: Email Address, for s2Member-specific emails; as configured by the site owner.
  1810. *
  1811. * ———— Quick PHP Code Sample ————
  1812. * ```
  1813. * <!php echo S2MEMBER_REG_EMAIL_FROM_EMAIL; !>
  1814. * ```
  1815. * ———— Shortcode & JavaScript Equivalents ————
  1816. * ```
  1817. * [s2Get constant="S2MEMBER_REG_EMAIL_FROM_EMAIL" /]
  1818. *
  1819. * <script type="text/javascript">
  1820. * document.write(S2MEMBER_REG_EMAIL_FROM_EMAIL);
  1821. * </script>
  1822. * ```
  1823. *
  1824. * @package s2Member\API_Constants
  1825. * @since 3.5
  1826. *
  1827. * @var str
  1828. *
  1829. * @see s2Member\API_Constants\S2MEMBER_REG_EMAIL_FROM_NAME
  1830. *
  1831. * @see `Dashboard -› s2Member -› General Options`
  1832. */
  1833. if (!defined ("S2MEMBER_REG_EMAIL_FROM_EMAIL"))
  1834. define ("S2MEMBER_REG_EMAIL_FROM_EMAIL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"]));
  1835. /**
  1836. * Full URL to PayPal® IPN handler, provided by s2Member.
  1837. *
  1838. * ———— Quick PHP Code Sample ————
  1839. * ```
  1840. * <!php echo S2MEMBER_PAYPAL_NOTIFY_URL; !>
  1841. * ```
  1842. * ———— Shortcode & JavaScript Equivalents ————
  1843. * ```
  1844. * [s2Get constant="S2MEMBER_PAYPAL_NOTIFY_URL" /]
  1845. *
  1846. * <script type="text/javascript">
  1847. * document.write(S2MEMBER_PAYPAL_NOTIFY_URL);
  1848. * </script>
  1849. * ```
  1850. *
  1851. * @package s2Member\API_Constants
  1852. * @since 3.5
  1853. *
  1854. * @var str
  1855. *
  1856. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_RETURN_URL
  1857. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN
  1858. *
  1859. * @see `Dashboard -› s2Member -› PayPal® Options -› IPN Integration`
  1860. */
  1861. if (!defined ("S2MEMBER_PAYPAL_NOTIFY_URL"))
  1862. define ("S2MEMBER_PAYPAL_NOTIFY_URL", ($c[] = (string)site_url ("/?s2member_paypal_notify=1")));
  1863. /**
  1864. * Full URL to PayPal® Auto-Return/PDT handler, provided by s2Member.
  1865. *
  1866. * ———— Quick PHP Code Sample ————
  1867. * ```
  1868. * <!php echo S2MEMBER_PAYPAL_RETURN_URL; !>
  1869. * ```
  1870. * ———— Shortcode & JavaScript Equivalents ————
  1871. * ```
  1872. * [s2Get constant="S2MEMBER_PAYPAL_RETURN_URL" /]
  1873. *
  1874. * <script type="text/javascript">
  1875. * document.write(S2MEMBER_PAYPAL_RETURN_URL);
  1876. * </script>
  1877. * ```
  1878. *
  1879. * @package s2Member\API_Constants
  1880. * @since 3.5
  1881. *
  1882. * @var str
  1883. *
  1884. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_NOTIFY_URL
  1885. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN
  1886. *
  1887. * @see `Dashboard -› s2Member -› PayPal® Options -› Auto-Return/PDT Integration`
  1888. */
  1889. if (!defined ("S2MEMBER_PAYPAL_RETURN_URL"))
  1890. define ("S2MEMBER_PAYPAL_RETURN_URL", ($c[] = (string)site_url ("/?s2member_paypal_return=1")));
  1891. /**
  1892. * PayPal® Business Email Address; as configured by the site owner.
  1893. *
  1894. * ———— Quick PHP Code Sample ————
  1895. * ```
  1896. * <!php echo S2MEMBER_PAYPAL_BUSINESS; !>
  1897. * ```
  1898. * ———— Shortcode & JavaScript Equivalents ————
  1899. * ```
  1900. * [s2Get constant="S2MEMBER_PAYPAL_BUSINESS" /]
  1901. *
  1902. * <script type="text/javascript">
  1903. * document.write(S2MEMBER_PAYPAL_BUSINESS);
  1904. * </script>
  1905. * ```
  1906. *
  1907. * @package s2Member\API_Constants
  1908. * @since 3.5
  1909. *
  1910. * @var str
  1911. *
  1912. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
  1913. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
  1914. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
  1915. *
  1916. * @see `Dashboard -› s2Member -› PayPal® Options -› Account Details`
  1917. */
  1918. if (!defined ("S2MEMBER_PAYPAL_BUSINESS"))
  1919. define ("S2MEMBER_PAYPAL_BUSINESS", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]));
  1920. /**
  1921. * PayPal® endpoint domain (changes when Sandbox Mode is enabled).
  1922. *
  1923. * o In Sandbox Mode, this is: `www.sandbox.paypal.com`.
  1924. * o In Production Mode, this is: `www.paypal.com`.
  1925. *
  1926. * ———— Quick PHP Code Sample ————
  1927. * ```
  1928. * <!php echo S2MEMBER_PAYPAL_ENDPOINT; !>
  1929. * ```
  1930. * ———— Shortcode & JavaScript Equivalents ————
  1931. * ```
  1932. * [s2Get constant="S2MEMBER_PAYPAL_ENDPOINT" /]
  1933. *
  1934. * <script type="text/javascript">
  1935. * document.write(S2MEMBER_PAYPAL_ENDPOINT);
  1936. * </script>
  1937. * ```
  1938. *
  1939. * @package s2Member\API_Constants
  1940. * @since 3.5
  1941. *
  1942. * @var str
  1943. *
  1944. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_ENDPOINT
  1945. *
  1946. * @see `Dashboard -› s2Member -› PayPal® Options -› Account Details`
  1947. */
  1948. if (!defined ("S2MEMBER_PAYPAL_ENDPOINT"))
  1949. define ("S2MEMBER_PAYPAL_ENDPOINT", ($c[] = (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")));
  1950. /**
  1951. * PayPal® API endpoint domain (changes when Sandbox Mode is enabled).
  1952. *
  1953. * o In Sandbox Mode, this is: `api-3t.sandbox.paypal.com`.
  1954. * o In Production Mode, this is: `api-3t.paypal.com`.
  1955. *
  1956. * ———— Quick PHP Code Sample ————
  1957. * ```
  1958. * <!php echo S2MEMBER_PAYPAL_API_ENDPOINT; !>
  1959. * ```
  1960. * ———— Shortcode & JavaScript Equivalents ————
  1961. * ```
  1962. * [s2Get constant="S2MEMBER_PAYPAL_API_ENDPOINT" /]
  1963. *
  1964. * <script type="text/javascript">
  1965. * document.write(S2MEMBER_PAYPAL_API_ENDPOINT);
  1966. * </script>
  1967. * ```
  1968. *
  1969. * @package s2Member\API_Constants
  1970. * @since 3.5
  1971. *
  1972. * @var str
  1973. *
  1974. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_ENDPOINT
  1975. *
  1976. * @see `Dashboard -› s2Member -› PayPal® Options -› Account Details`
  1977. */
  1978. if (!defined ("S2MEMBER_PAYPAL_API_ENDPOINT"))
  1979. define ("S2MEMBER_PAYPAL_API_ENDPOINT", ($c[] = (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "api-3t.sandbox.paypal.com" : "api-3t.paypal.com")));
  1980. /**
  1981. * PayPal® API Username; as configured by the site owner.
  1982. *
  1983. * ———— Quick PHP Code Sample ————
  1984. * ```
  1985. * <!php echo S2MEMBER_PAYPAL_API_USERNAME; !>
  1986. * ```
  1987. * ———— Shortcode & JavaScript Equivalents ————
  1988. * ```
  1989. * [s2Get constant="S2MEMBER_PAYPAL_API_USERNAME" /]
  1990. *
  1991. * NOTE: For security purposes,
  1992. * this API Constant is NOT available as a JavaScript Global.
  1993. * ```
  1994. *
  1995. * @package s2Member\API_Constants
  1996. * @since 3.5
  1997. *
  1998. * @var str
  1999. *
  2000. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_BUSINESS
  2001. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
  2002. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
  2003. *
  2004. * @see `Dashboard -› s2Member -› PayPal® Options -› Account Details`
  2005. */
  2006. if (!defined ("S2MEMBER_PAYPAL_API_USERNAME"))
  2007. define ("S2MEMBER_PAYPAL_API_USERNAME", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"]));
  2008. /**
  2009. * PayPal® API Password; as configured by the site owner.
  2010. *
  2011. * ———— Quick PHP Code Sample ————
  2012. * ```
  2013. * <!php echo S2MEMBER_PAYPAL_API_PASSWORD; !>
  2014. * ```
  2015. * ———— Shortcode & JavaScript Equivalents ————
  2016. * ```
  2017. * [s2Get constant="S2MEMBER_PAYPAL_API_PASSWORD" /]
  2018. *
  2019. * NOTE: For security purposes,
  2020. * this API Constant is NOT available as a JavaScript Global.
  2021. * ```
  2022. *
  2023. * @package s2Member\API_Constants
  2024. * @since 3.5
  2025. *
  2026. * @var str
  2027. *
  2028. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_BUSINESS
  2029. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
  2030. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
  2031. *
  2032. * @see `Dashboard -› s2Member -› PayPal® Options -› Account Details`
  2033. */
  2034. if (!defined ("S2MEMBER_PAYPAL_API_PASSWORD"))
  2035. define ("S2MEMBER_PAYPAL_API_PASSWORD", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_password"]));
  2036. /**
  2037. * PayPal® API Signature; as configured by the site owner.
  2038. *
  2039. * ———— Quick PHP Code Sample ————
  2040. * ```
  2041. * <!php echo S2MEMBER_PAYPAL_API_SIGNATURE; !>
  2042. * ```
  2043. * ———— Shortcode & JavaScript Equivalents ————
  2044. * ```
  2045. * [s2Get constant="S2MEMBER_PAYPAL_API_SIGNATURE" /]
  2046. *
  2047. * NOTE: For security purposes,
  2048. * this API Constant is NOT available as a JavaScript Global.
  2049. * ```
  2050. *
  2051. * @package s2Member\API_Constants
  2052. * @since 3.5
  2053. *
  2054. * @var str
  2055. *
  2056. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_BUSINESS
  2057. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
  2058. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
  2059. *
  2060. * @see `Dashboard -› s2Member -› PayPal® Options -› Account Details`
  2061. */
  2062. if (!defined ("S2MEMBER_PAYPAL_API_SIGNATURE"))
  2063. define ("S2MEMBER_PAYPAL_API_SIGNATURE", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"]));
  2064. /**
  2065. * PayPal® PDT Identity Token; as configured by the site owner.
  2066. *
  2067. * ———— Quick PHP Code Sample ————
  2068. * ```
  2069. * <!php echo S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN; !>
  2070. * ```
  2071. * ———— Shortcode & JavaScript Equivalents ————
  2072. * ```
  2073. * [s2Get constant="S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN" /]
  2074. *
  2075. * NOTE: For security purposes,
  2076. * this API Constant is NOT available as a JavaScript Global.
  2077. * ```
  2078. *
  2079. * @package s2Member\API_Constants
  2080. * @since 3.5
  2081. *
  2082. * @var str
  2083. *
  2084. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_RETURN_URL
  2085. * @see s2Member\API_Constants\S2MEMBER_PAYPAL_NOTIFY_URL
  2086. *
  2087. * @see `Dashboard -› s2Member -› PayPal® Options -› Auto-Return/PDT Integration`
  2088. */
  2089. if (!defined ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN"))
  2090. define ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"]));
  2091. /**
  2092. * PayPal® value for Payment Buttons with input name: `invoice`.
  2093. *
  2094. * This can be used to auto-fill the `invoice` value in PayPal® Button Codes, with a unique Code~IP combination.
  2095. * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
  2096. *
  2097. * Note. This API Constant is excluded from the ``$c[]`` hash calculation used in the generation of {@link s2Member\API_Constants\WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5}.
  2098. * It MUST be excluded, because the value of this particular API Constant will change too often *(i.e. it changes, depending on microtime)*.
  2099. * So, when including this API Constant in the JavaScript API as a Global, care must be taken to build an Invoice, using JavaScript
  2100. * to calculate the unique time-based code, with something like: `Math.round (new Date ().getTime ())`.
  2101. *
  2102. * These five API Constants are special.
  2103. * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
  2104. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
  2105. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
  2106. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
  2107. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
  2108. *
  2109. * They are used by the PayPal® Button Generator for s2Member.
  2110. *
  2111. * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
  2112. * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
  2113. *
  2114. * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
  2115. * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
  2116. *
  2117. * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
  2118. * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
  2119. * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
  2120. * you won't even see these, because they're added internally by the Shortcode processor.
  2121. *
  2122. * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
  2123. *
  2124. * Anyway, these five API Constants are just documented here for clarity;
  2125. * you probably won't use any of these directly; the Button Generator pops them in.
  2126. *
  2127. * ———— Quick PHP Code Sample ————
  2128. * ```
  2129. * <!php echo S2MEMBER_VALUE_FOR_PP_INV; !>
  2130. * ```
  2131. * ———— Shortcode & JavaScript Equivalents ————
  2132. * ```
  2133. * [s2Get constant="S2MEMBER_VALUE_FOR_PP_INV" /]
  2134. *
  2135. * <script type="text/javascript">
  2136. * document.write(S2MEMBER_VALUE_FOR_PP_INV);
  2137. * </script>
  2138. * ```
  2139. *
  2140. * @package s2Member\API_Constants
  2141. * @since 110720
  2142. *
  2143. * @var str
  2144. *
  2145. * @see s2Member\API_Functions\s2member_value_for_pp_inv()
  2146. *
  2147. * @see `Dashboard -› s2Member -› PayPal® Buttons`
  2148. */
  2149. if (!defined ("S2MEMBER_VALUE_FOR_PP_INV"))
  2150. define ("S2MEMBER_VALUE_FOR_PP_INV", uniqid () . "~" . S2MEMBER_CURRENT_USER_IP);
  2151. /**
  2152. * PayPal® value for Payment Buttons with input name: `on0`.
  2153. *
  2154. * Used in PayPal® Modification Buttons *(i.e. upgrades/downgrades)*.
  2155. *
  2156. * This auto-fills the `on0` value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member,
  2157. * this will auto-fill the value for the `on0` input variable, with the string: "Referencing Customer ID".
  2158. * Otherwise, it will be set to a default value of: "Originating Domain".
  2159. *
  2160. * These five API Constants are special.
  2161. * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
  2162. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
  2163. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
  2164. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
  2165. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
  2166. *
  2167. * They are used by the PayPal® Button Generator for s2Member.
  2168. *
  2169. * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
  2170. * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
  2171. *
  2172. * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
  2173. * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
  2174. *
  2175. * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
  2176. * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
  2177. * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
  2178. * you won't even see these, because they're added internally by the Shortcode processor.
  2179. *
  2180. * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
  2181. *
  2182. * Anyway, these five API Constants are just documented here for clarity;
  2183. * you probably won't use any of these directly; the Button Generator pops them in.
  2184. *
  2185. * ———— Quick PHP Code Sample ————
  2186. * ```
  2187. * <!php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; !>
  2188. * ```
  2189. * ———— Shortcode & JavaScript Equivalents ————
  2190. * ```
  2191. * [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0" /]
  2192. *
  2193. * <script type="text/javascript">
  2194. * document.write(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0);
  2195. * </script>
  2196. * ```
  2197. *
  2198. * @package s2Member\API_Constants
  2199. * @since 3.5
  2200. *
  2201. * @var str
  2202. *
  2203. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0
  2204. *
  2205. * @see `Dashboard -› s2Member -› PayPal® Buttons`
  2206. */
  2207. if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0"))
  2208. define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) ? "Referencing Customer ID" : "Originating Domain")));
  2209. /**
  2210. * PayPal® value for Payment Buttons with input name: `os0`.
  2211. *
  2212. * Used in PayPal® Modification Buttons *(i.e. upgrades/downgrades)*.
  2213. *
  2214. * This auto-fills the `os0` value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member,
  2215. * this will auto-fill the value for the `os0` input variable, with the value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID}.
  2216. * Otherwise, it will be set to a default value of ``$_SERVER["HTTP_HOST"]`` *(the originating domain name)*.
  2217. *
  2218. * These five API Constants are special.
  2219. * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
  2220. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
  2221. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
  2222. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
  2223. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
  2224. *
  2225. * They are used by the PayPal® Button Generator for s2Member.
  2226. *
  2227. * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
  2228. * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
  2229. *
  2230. * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
  2231. * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
  2232. *
  2233. * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
  2234. * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
  2235. * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
  2236. * you won't even see these, because they're added internally by the Shortcode processor.
  2237. *
  2238. * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
  2239. *
  2240. * Anyway, these five API Constants are just documented here for clarity;
  2241. * you probably won't use any of these directly; the Button Generator pops them in.
  2242. *
  2243. * ———— Quick PHP Code Sample ————
  2244. * ```
  2245. * <!php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0; !>
  2246. * ```
  2247. * ———— Shortcode & JavaScript Equivalents ————
  2248. * ```
  2249. * [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0" /]
  2250. *
  2251. * <script type="text/javascript">
  2252. * document.write(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0);
  2253. * </script>
  2254. * ```
  2255. *
  2256. * @package s2Member\API_Constants
  2257. * @since 3.5
  2258. *
  2259. * @var str
  2260. *
  2261. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0
  2262. *
  2263. * @see `Dashboard -› s2Member -› PayPal® Buttons`
  2264. */
  2265. if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0"))
  2266. define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) ? S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID : (string)$_SERVER["HTTP_HOST"])));
  2267. /**
  2268. * PayPal® value for Payment Buttons with input name: `on1`.
  2269. *
  2270. * This auto-fills the `on1` value in PayPal® Button Codes.
  2271. * This always contains the string: "Customer IP Address".
  2272. *
  2273. * These five API Constants are special.
  2274. * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
  2275. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
  2276. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
  2277. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
  2278. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
  2279. *
  2280. * They are used by the PayPal® Button Generator for s2Member.
  2281. *
  2282. * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
  2283. * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
  2284. *
  2285. * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
  2286. * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
  2287. *
  2288. * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
  2289. * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
  2290. * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
  2291. * you won't even see these, because they're added internally by the Shortcode processor.
  2292. *
  2293. * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
  2294. *
  2295. * Anyway, these five API Constants are just documented here for clarity;
  2296. * you probably won't use any of these directly; the Button Generator pops them in.
  2297. *
  2298. * ———— Quick PHP Code Sample ————
  2299. * ```
  2300. * <!php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1; !>
  2301. * ```
  2302. * ———— Shortcode & JavaScript Equivalents ————
  2303. * ```
  2304. * [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1" /]
  2305. *
  2306. * <script type="text/javascript">
  2307. * document.write(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1);
  2308. * </script>
  2309. * ```
  2310. *
  2311. * @package s2Member\API_Constants
  2312. * @since 3.5
  2313. *
  2314. * @var str
  2315. *
  2316. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1
  2317. *
  2318. * @see `Dashboard -› s2Member -› PayPal® Buttons`
  2319. */
  2320. if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1"))
  2321. define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1", ($c[] = "Customer IP Address" /* Via $_SERVER["REMOTE_ADDR"] below. */));
  2322. /**
  2323. * PayPal® value for Payment Buttons with input name: `os1`.
  2324. *
  2325. * This auto-fills the `os1` value in PayPal® Button Codes,
  2326. * with the Customer's IP Address, via ``$_SERVER["REMOTE_ADDR"]``.
  2327. *
  2328. * These five API Constants are special.
  2329. * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
  2330. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
  2331. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
  2332. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
  2333. * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
  2334. *
  2335. * They are used by the PayPal® Button Generator for s2Member.
  2336. *
  2337. * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
  2338. * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
  2339. *
  2340. * The `ON0/OS0` values, are how s2Member identifies an existing Member *(and/or a Free Subscriber)*, who is already logged-in
  2341. * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
  2342. *
  2343. * Instead of forcing a Member *(and/or a Free Subscriber)* to re-register for a new account,
  2344. * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
  2345. * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
  2346. * you won't even see these, because they're added internally by the Shortcode processor.
  2347. *
  2348. * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
  2349. *
  2350. * Anyway, these five API Constants are just documented here for clarity;
  2351. * you probably won't use any of these directly; the Button Generator pops them in.
  2352. *
  2353. * ———— Quick PHP Code Sample ————
  2354. * ```
  2355. * <!php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1; !>
  2356. * ```
  2357. * ———— Shortcode & JavaScript Equivalents ————
  2358. * ```
  2359. * [s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1" /]
  2360. *
  2361. * <script type="text/javascript">
  2362. * document.write(S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1);
  2363. * </script>
  2364. * ```
  2365. *
  2366. * @package s2Member\API_Constants
  2367. * @since 3.5
  2368. *
  2369. * @var str
  2370. *
  2371. * @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1
  2372. *
  2373. * @see `Dashboard -› s2Member -› PayPal® Buttons`
  2374. */
  2375. if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1"))
  2376. define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1", ($c[] = (string)$_SERVER["REMOTE_ADDR"]));
  2377. /*
  2378. Allows other Constants to be calculated with their checksums included too.
  2379. */
  2380. $c = apply_filters ("ws_plugin__s2member_during_constants_c", $c, get_defined_vars ());
  2381. /**
  2382. * Used internally by s2Member to compare the value of all API Constants at once.
  2383. *
  2384. * @package s2Member\API_Constants
  2385. * @since 3.5
  2386. *
  2387. * @var str
  2388. */
  2389. if (!defined ("WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5"))
  2390. define ("WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5", md5 (serialize ($c) . c_ws_plugin__s2member_utilities::ver_checksum ()));
  2391. /*
  2392. Calls the after Hook. Do NOT set Constants here.
  2393. */
  2394. do_action ("ws_plugin__s2member_after_constants", get_defined_vars ());
  2395.  
  2396. return /* Return for uniformity. */;
  2397. }
  2398. }
  2399. }
  2400. ?>

s2member\includes\classes\constants.inc.php

Source Code Documentation