Source Code Documentation


pro\s2member-pro\includes\menu-pages\ccbill-ops.inc.php


  1. <?php
  2. /**
  3. * Menu page for s2Member Pro (ccBill® Options page).
  4. *
  5. * Copyright: © 2009-2011
  6. * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
  7. * (coded in the USA)
  8. *
  9. * This WordPress® plugin (s2Member Pro) is comprised of two parts:
  10. *
  11. * o (1) Its PHP code is licensed under the GPL license, as is WordPress®.
  12. * You should have received a copy of the GNU General Public License,
  13. * along with this software. In the main directory, see: /licensing/
  14. * If not, see: {@link http://www.gnu.org/licenses/}.
  15. *
  16. * o (2) All other parts of (s2Member Pro); including, but not limited to:
  17. * the CSS code, some JavaScript code, images, and design;
  18. * are licensed according to the license purchased.
  19. * See: {@link http://www.s2member.com/prices/}
  20. *
  21. * Unless you have our prior written consent, you must NOT directly or indirectly license,
  22. * sub-license, sell, resell, or provide for free; part (2) of the s2Member Pro Module;
  23. * or make an offer to do any of these things. All of these things are strictly
  24. * prohibited with part (2) of the s2Member Pro Module.
  25. *
  26. * Your purchase of s2Member Pro includes free lifetime upgrades via s2Member.com
  27. * (i.e. new features, bug fixes, updates, improvements); along with full access
  28. * to our video tutorial library: {@link http://www.s2member.com/videos/}
  29. *
  30. * @package s2Member\Menu_Pages
  31. * @since 1.5
  32. */
  33. if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
  34. exit("Do not access this file directly.");
  35.  
  36. if(!class_exists("c_ws_plugin__s2member_pro_menu_page_ccbill_ops"))
  37. {
  38. /**
  39. * Menu page for s2Member Pro (ccBill® Options page).
  40. *
  41. * @package s2Member\Menu_Pages
  42. * @since 110531
  43. */
  44. class c_ws_plugin__s2member_pro_menu_page_ccbill_ops
  45. {
  46. public function __construct()
  47. {
  48. echo '<div class="wrap ws-menu-page">'."\n";
  49.  
  50. echo '<div id="icon-plugins" class="icon32"><br /></div>'."\n";
  51. echo '<h2>s2Member® Pro / ccBill® Options</h2>'."\n";
  52.  
  53. echo '<table class="ws-menu-page-table">'."\n";
  54. echo '<tbody class="ws-menu-page-table-tbody">'."\n";
  55. echo '<tr class="ws-menu-page-table-tr">'."\n";
  56. echo '<td class="ws-menu-page-table-l">'."\n";
  57.  
  58. echo '<form method="post" name="ws_plugin__s2member_pro_options_form" id="ws-plugin--s2member-pro-options-form">'."\n";
  59. echo '<input type="hidden" name="ws_plugin__s2member_options_save" id="ws-plugin--s2member-options-save" value="'.esc_attr(wp_create_nonce("ws-plugin--s2member-options-save")).'" />'."\n";
  60.  
  61. echo '<div class="ws-menu-page-group" title="ccBill® Account Details">'."\n";
  62.  
  63. echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-ccbill-account-details-section">'."\n";
  64. echo '<h3>ccBill® Account Details (required)</h3>'."\n";
  65. echo '<p><a href="http://www.s2member.com/ccbill" target="_blank" rel="external">ccBill®</a> is a great choice when you need to process transactions discreetly on an adult-oriented site. Drawing on its years of experience and proven payment processing platform, ccBill® has a solution that will not only meet the requirements of your consumers, it will also help address the specific needs of your business.</p>'."\n";
  66. echo '<p>s2Member has been integrated with ccBill® for Direct Payments and also for Recurring Billing. In order to take advantage of this integration, you will need to have a ccBill® Client Account. Once you have an account, all of the details below can be generated from inside of your ccBill® Client account, or by contacting ccBill® via live chat. If you need further assistance, please check their <a href="http://www.s2member.com/ccbill-help" target="_blank" rel="external">help section</a>.</p>'."\n";
  67. echo '<p><em><strong>*Important*</strong> User Management needs to be turned <code>off</code> in your ccBill® account. s2Member\'s integration with ccBill® does NOT require ccBill® to manage Usernames/Passwords. Instead, s2Member needs to be given exclusive permission to handle this for you. In your ccBill® account, see: <code>Account Admin -› User Management</code>. Turn this <code>off</code>, and choose: <code>Do NOT collect Usernames/Passwords</code>. You will also want to remove Username/Password references in the <code>APPROVAL</code> Email Receipt configured in your ccBill® account. In your ccBill® account, see: <code>Account Admin -› Custom Emails</code>.</em></p>'."\n";
  68.  
  69. echo '<table class="form-table">'."\n";
  70. echo '<tbody>'."\n";
  71. echo '<tr>'."\n";
  72.  
  73. echo '<th>'."\n";
  74. echo '<label for="ws-plugin--s2member-pro-ccbill-client-id">'."\n";
  75. echo 'Client Account ID:'."\n";
  76. echo '</label>'."\n";
  77. echo '</th>'."\n";
  78.  
  79. echo '</tr>'."\n";
  80. echo '<tr>'."\n";
  81.  
  82. echo '<td>'."\n";
  83. echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_pro_ccbill_client_id" id="ws-plugin--s2member-pro-ccbill-client-id" value="'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_id"]).'" /><br />'."\n";
  84. echo 'This is provided by ccBill®. Check your ccBill® Client account for this information.'."\n";
  85. echo '</td>'."\n";
  86.  
  87. echo '</tr>'."\n";
  88. echo '<tr>'."\n";
  89.  
  90. echo '<th>'."\n";
  91. echo '<label for="ws-plugin--s2member-pro-ccbill-client-sid">'."\n";
  92. echo 'Client Sub-Account ID:'."\n";
  93. echo '</label>'."\n";
  94. echo '</th>'."\n";
  95.  
  96. echo '</tr>'."\n";
  97. echo '<tr>'."\n";
  98.  
  99. echo '<td>'."\n";
  100. echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_pro_ccbill_client_sid" id="ws-plugin--s2member-pro-ccbill-client-sid" value="'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_client_sid"]).'" /><br />'."\n";
  101. echo 'Check your ccBill® Client account for this. Often times, this is just: <code>0000</code>.'."\n";
  102. echo '</td>'."\n";
  103.  
  104. echo '</tr>'."\n";
  105. echo '<tr>'."\n";
  106.  
  107. echo '<th>'."\n";
  108. echo '<label for="ws-plugin--s2member-pro-ccbill-form-name">'."\n";
  109. echo 'Form (w/ Dynamic Pricing):'."\n";
  110. echo '</label>'."\n";
  111. echo '</th>'."\n";
  112.  
  113. echo '</tr>'."\n";
  114. echo '<tr>'."\n";
  115.  
  116. echo '<td>'."\n";
  117. echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_pro_ccbill_form_name" id="ws-plugin--s2member-pro-ccbill-form-name" value="'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_form_name"]).'" /><br />'."\n";
  118. echo 'Ex: <code>921cc</code>. Inside your ccBill® Client account, go to <code>Account Admin -› Form Admin -› Create New Form</code>. Whenever you create the new Form, you will need to configure ccBill® Pricing for this Form as "Dynamic" (very important). This one Dynamic Pricing Form will be used by s2Member for all Membership purchases. If ccBill® asks you to supply a textual description, we suggest something very general like: <code>'.esc_html($_SERVER["HTTP_HOST"]).'</code>.'."\n";
  119. echo '</td>'."\n";
  120.  
  121. echo '</tr>'."\n";
  122. echo '<tr>'."\n";
  123.  
  124. echo '<th>'."\n";
  125. echo '<label for="ws-plugin--s2member-pro-ccbill-salt-key">'."\n";
  126. echo 'Triple DES Encryption Key:'."\n";
  127. echo '</label>'."\n";
  128. echo '</th>'."\n";
  129.  
  130. echo '</tr>'."\n";
  131. echo '<tr>'."\n";
  132.  
  133. echo '<td>'."\n";
  134. echo '<input type="password" autocomplete="off" name="ws_plugin__s2member_pro_ccbill_salt_key" id="ws-plugin--s2member-pro-ccbill-salt-key" value="'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_salt_key"]).'" /><br />'."\n";
  135. echo 'ccBill® requires you to contact them via live chat for this Encryption Key. You will need to ask your ccBill® support representative for a Triple DES Encryption Key. Sometimes referred to as a Dynamic Pricing Salt. s2Member needs this Key in order to communicate with ccBill®, and to properly configure your Dynamic Pricing Form.'."\n";
  136. echo '</td>'."\n";
  137.  
  138. echo '</tr>'."\n";
  139.  
  140. if(!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site())
  141. {
  142. echo '<tr>'."\n";
  143.  
  144. echo '<th>'."\n";
  145. echo '<label for="ws-plugin--s2member-gateway-debug-logs">'."\n";
  146. echo 'Enable Logging Routines?<br />'."\n";
  147. echo '<small><em class="ws-menu-page-hilite">* This setting applies universally. [ <a href="#" onclick="alert(\'This configuration option may ALSO appear under (s2Member -› PayPal® Options). Feel free to configure it here; but please remember that this setting is applied universally (i.e. SHARED) among all Payment Gateways integrated with s2Member.\'); return false;">?</a> ]</em></small>'."\n";
  148. echo '</label>'."\n";
  149. echo '</th>'."\n";
  150.  
  151. echo '</tr>'."\n";
  152. echo '<tr>'."\n";
  153.  
  154. echo '<td>'."\n";
  155. echo '<input type="radio" name="ws_plugin__s2member_gateway_debug_logs" id="ws-plugin--s2member-gateway-debug-logs-0" value="0"'.((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) ? ' checked="checked"' : '').' /> <label for="ws-plugin--s2member-gateway-debug-logs-0">No</label> &nbsp;&nbsp;&nbsp; <input type="radio" name="ws_plugin__s2member_gateway_debug_logs" id="ws-plugin--s2member-gateway-debug-logs-1" value="1"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) ? ' checked="checked"' : '').' /> <label for="ws-plugin--s2member-gateway-debug-logs-1">Yes, enable debugging, with API, IPN &amp; Return Page logging.</label><br />'."\n";
  156. echo '<em>This enables API, IPN and Return Page logging. The log files are stored here: <code>'.esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"])).'</code></em><br />'."\n";
  157. echo '<em class="ws-menu-page-hilite">If you have any trouble, please review your s2Member® log files for problems. See: <a href="'.esc_attr(admin_url("/admin.php?page=ws-plugin--s2member-logs")).'">Log Viewer</a></em>'."\n";
  158. echo '</td>'."\n";
  159.  
  160. echo '</tr>'."\n";
  161. echo '<tr>'."\n";
  162.  
  163. echo '<td>'."\n";
  164. echo '<div class="ws-menu-page-hilite" style="border-radius:3px; padding:5px;">'."\n";
  165. echo '<p style="font-size:110%; margin-top:0;"><span>We HIGHLY recommend that you enable logging during your initial testing phase. Logs produce lots of useful details that can help in debugging. Logs can help you find issues in your configuration and/or problems during payment processing. See: <a href="'.esc_attr(admin_url("/admin.php?page=ws-plugin--s2member-logs")).'">Log Files (Debug)</a>.</span></p>'."\n";
  166. echo '<p style="font-size:110%; margin-bottom:0;"><span class="ws-menu-page-error">However, it is VERY IMPORTANT to disable logging once you go live. Log files may contain personally identifiable information, credit card numbers, secret API credentials, passwords and/or other sensitive information. We STRONGLY suggest that logging be disabled on a live site (for security reasons).</span></p>'."\n";
  167. echo '</div>'."\n";
  168. echo '</td>'."\n";
  169.  
  170. echo '</tr>'."\n";
  171. }
  172.  
  173. echo '</tbody>'."\n";
  174. echo '</table>'."\n";
  175. echo '</div>'."\n";
  176.  
  177. echo '</div>'."\n";
  178.  
  179. echo '<div class="ws-menu-page-group" title="ccBill® DataLink Integration">'."\n";
  180.  
  181. echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-ccbill-datalink-section">'."\n";
  182. echo '<h3>ccBill® DataLink Integration (required)</h3>'."\n";
  183. echo '<p>Inside your ccBill® Client account, go to <code>Account Info Tab -› DataLink Service Suite -› Add User</code>. If ccBill® asks you for an IP Address/Range, use: <code>'.esc_html($_SERVER["SERVER_ADDR"]).'</code> (this is your server\'s IP address). <em>*Note* If you\'re on shared hosting, or you\'re hosted on a cloud computing model, such as MediaTemple® (gs), or the Rackspace® Cloud; your server\'s IP address (<code>'.esc_html($_SERVER["SERVER_ADDR"]).'</code>) may change dynamically. So in these cases, you will need a true IP address "range". This information (i.e. a range of IP addresses) should be obtained by contacting your hosting facility.</em></p>'."\n";
  184. echo '<p><em><strong>*Note*</strong> By default, s2Member is allowed to pull details related to any Subscription rebill attempts, Subscription expirations, refunds, and/or chargebacks. However, s2Member is NOT allowed to pull details related to customer-initiated Subscription cancellations. If you want s2Member to handle customer-initiated cancellations (i.e. to terminate access automatically, and at the appropriate time), you will need approval from ccBill®. Please contact ccBill® to enable DataLink "cancellations". If you\'re approved, you will also need to enable this feature in the options below.</em></p>'."\n";
  185.  
  186. echo '<table class="form-table">'."\n";
  187. echo '<tbody>'."\n";
  188. echo '<tr>'."\n";
  189.  
  190. echo '<th>'."\n";
  191. echo '<label for="ws-plugin--s2member-pro-ccbill-dl-user">'."\n";
  192. echo 'DataLink Username:'."\n";
  193. echo '</label>'."\n";
  194. echo '</th>'."\n";
  195.  
  196. echo '</tr>'."\n";
  197. echo '<tr>'."\n";
  198.  
  199. echo '<td>'."\n";
  200. echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_pro_ccbill_dl_user" id="ws-plugin--s2member-pro-ccbill-dl-user" value="'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_dl_user"]).'" /><br />'."\n";
  201. echo 'Ex: <code>s2member</code>. Inside your ccBill® Client account, go to <code>Account Info Tab -› DataLink Service Suite -› Add User</code>.</em>'."\n";
  202. echo '</td>'."\n";
  203.  
  204. echo '</tr>'."\n";
  205. echo '<tr>'."\n";
  206.  
  207. echo '<th>'."\n";
  208. echo '<label for="ws-plugin--s2member-pro-ccbill-dl-pass">'."\n";
  209. echo 'DataLink Password:'."\n";
  210. echo '</label>'."\n";
  211. echo '</th>'."\n";
  212.  
  213. echo '</tr>'."\n";
  214. echo '<tr>'."\n";
  215.  
  216. echo '<td>'."\n";
  217. echo '<input type="password" autocomplete="off" name="ws_plugin__s2member_pro_ccbill_dl_pass" id="ws-plugin--s2member-pro-ccbill-dl-pass" value="'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_dl_pass"]).'" />'."\n";
  218. echo '</td>'."\n";
  219.  
  220. echo '</tr>'."\n";
  221. echo '<tr>'."\n";
  222.  
  223. echo '<th>'."\n";
  224. echo '<label for="ws-plugin--s2member-pro-ccbill-dl-cancellations">'."\n";
  225. echo 'DataLink Cancellations:'."\n";
  226. echo '</label>'."\n";
  227. echo '</th>'."\n";
  228.  
  229. echo '</tr>'."\n";
  230. echo '<tr>'."\n";
  231.  
  232. echo '<td>'."\n";
  233. echo '<select name="ws_plugin__s2member_pro_ccbill_dl_cancellations" id="ws-plugin--s2member-pro-ccbill-dl-cancellations">'."\n";
  234. echo '<option value="0"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_dl_cancellations"] === "0") ? ' selected="selected"' : '').'>No (not required, or not yet approved)</option>'."\n";
  235. echo '<option value="1"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_dl_cancellations"] === "1") ? ' selected="selected"' : '').'>Yes (ccBill® approved me for this)</option>'."\n";
  236. echo '</select><br />'."\n";
  237. echo 'See note above. Do NOT enable this until you receive approval from ccBill®.'."\n";
  238. echo '</td>'."\n";
  239.  
  240. echo '</tr>'."\n";
  241. echo '</tbody>'."\n";
  242. echo '</table>'."\n";
  243. echo '</div>'."\n";
  244.  
  245. echo '</div>'."\n";
  246.  
  247. echo '<div class="ws-menu-page-group" title="ccBill® Approval/Denial URLs">'."\n";
  248.  
  249. echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-ccbill-auto-return-section">'."\n";
  250. echo '<h3>ccBill® Approval/Denial URLs (required)<br />aka: ccBill® Auto-Return Page Integration</h3>'."\n";
  251. echo '<p>Log into your ccBill® Client account and navigate to this section:<br /><code>Account Admin -› Basic</code></p>'."\n";
  252. echo '<p>Your <a href="'.esc_attr(site_url("/?s2member_pro_ccbill_return&s2member_paypal_return=1&s2member_paypal_proxy=ccbill&s2member_paypal_proxy_use=x-preview")).'" target="_blank" rel="external">ccBill® Approval URL</a> is:<br /><code>'.esc_html(site_url("/?s2member_pro_ccbill_return=1")).'</code></p>'."\n";
  253. echo '<p>Your ccBill® Denial URL is:<br /><code>'.esc_html(site_url("/?s2member_pro_ccbill_return=0")).'</code></p>'."\n";
  254.  
  255. echo '<div class="ws-menu-page-hr"></div>'."\n";
  256.  
  257. echo '<h3>Approval Page Template (<a href="#" onclick="jQuery(\'div#ws-plugin--s2member-pro-ccbill-return-page-template\').toggle(); return false;" class="ws-dotted-link">optional customizations</a>)</h3>'."\n";
  258. echo '<div id="ws-plugin--s2member-pro-ccbill-return-page-template" style="display:none;">'."\n";
  259. echo '<p>With s2Member Pro installed, you have the ability to customize your <a href="'.esc_attr(site_url("/?s2member_pro_ccbill_return&s2member_paypal_return=1&s2member_paypal_proxy=ccbill&s2member_paypal_proxy_use=x-preview")).'" target="_blank" rel="external">Approval Page Template</a>. Each of your Customers are returned back to your site immediately after they complete checkout at ccBill®. Your Approval Page displays a message and instructions for the Customer. s2Member may change the message and instructions dynamically, based on what the Customer is actually doing <em>(i.e. based on the type of transaction that is taking place)</em>. So, although we do NOT recommend that you attempt to change the message and instructions presented dynamically by s2Member, you CAN certainly control the Header, and/or the overall appearance of s2Member\'s Approval Page Template.</p>'."\n";
  260. echo '<p>The quickest/easiest way, is to simply add some HTML code in the box below. For instance, you might include an &lt;img&gt; tag with your logo. The box below, allows you to customize the Header section <em>(i.e. the top)</em> of s2Member\'s default Approval Page Template. Everything else, including the textual response and other important details that each Customer needs to know about, are already handled dynamically by s2Member <em>(based on the type of transaction that is taking place)</em>. All you need to do is customize the Header with your logo and anything else you feel is important. Although this Header customization is completely optional, we recommend an <a href="http://www.w3schools.com/tags/tag_img.asp" target="_blank" rel="external">&lt;img&gt; tag</a>, with a logo that is around 300px wide. After you "Save All Changes" below, you may <a href="'.esc_attr(site_url("/?s2member_pro_ccbill_return&s2member_paypal_return=1&s2member_paypal_proxy=ccbill&s2member_paypal_proxy_use=x-preview")).'" target="_blank" rel="external">click this link to see what your Header looks like</a>.</p>'."\n";
  261.  
  262. echo '<table class="form-table">'."\n";
  263. echo '<tbody>'."\n";
  264. echo '<tr>'."\n";
  265.  
  266. echo '<th>'."\n";
  267. echo '<label for="ws-plugin--s2member-pro-ccbill-return-template-header">'."\n";
  268. echo 'Approval Page Template Header:'."\n";
  269. echo '</label>'."\n";
  270. echo '</th>'."\n";
  271.  
  272. echo '</tr>'."\n";
  273. echo '<tr>'."\n";
  274.  
  275. echo '<td>'."\n";
  276. echo '<textarea name="ws_plugin__s2member_pro_ccbill_return_template_header" id="ws-plugin--s2member-pro-ccbill-return-template-header" rows="5" wrap="off" spellcheck="false">'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_return_template_header"]).'</textarea><br />'."\n";
  277. echo 'Any valid XHTML / JavaScript'.((is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) ? '' : ' (or even PHP)').' code will work just fine here.'."\n";
  278. echo '</td>'."\n";
  279.  
  280. echo '</tr>'."\n";
  281. echo '</tbody>'."\n";
  282. echo '</table>'."\n";
  283.  
  284. echo '<div class="ws-menu-page-hr"></div>'."\n";
  285.  
  286. if(!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site())
  287. echo '<p>It is also possible to build your own Approval Page Template, if you prefer. If you feel the need to create your own Approval Page Template, please make a copy of s2Member\'s default template: <code>'.esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir"]."/includes/templates/returns/default-template.php")).'</code>. Place your copy of this default template, inside your active WordPress® theme directory, and name the file: <code>/ccbill-return.php</code>. s2Member will automatically find your Approval Page Template in this location, and s2Member will use your template, instead of the default. Further details are provided inside s2Member\'s default template file. Once your custom template file is in place, you may <a href="'.esc_attr(site_url("/?s2member_pro_ccbill_return&s2member_paypal_return=1&s2member_paypal_proxy=ccbill&s2member_paypal_proxy_use=x-preview")).'" target="_blank" rel="external">click this link to see what it looks like</a>.</p>'."\n";
  288.  
  289. echo '<p>It is also possible to bypass s2Member\'s "Approval" system all together, if you prefer. This only works with the "Approval" system, and NOT with the Denial system <em>(it\'s not really needed in that case anyway)</em>. You can take your default Approval URL <em>(shown above)</em>, and add <code>&s2member_pro_ccbill_return_success=http://...</code> where the value can be set to a custom Approval URL that you prefer. In other words, if you use the <code>&s2member_pro_ccbill_return_success=http://...</code> parameter in your Approval URL, the initial redirection back to s2Member\'s default Approval system MUST still occur. However, instead of s2Member displaying its Approval Template to the Customer, s2Member will silently redirect the Customer to the URL that you specified in the <code>&s2member_pro_ccbill_return_success=http://...</code> parameter, allowing you to take complete control over what happens next. Click for an [ <a href="#" onclick="alert(\'Basic Example (please remember to URL encode the value):\\n'.esc_attr(site_url("/?s2member_pro_ccbill_return=1&s2member_pro_ccbill_return_success=".site_url("/thank-you/"))).'\\n\\nProper Example (with the URL having been encoded properly):\\n'.esc_attr(site_url("/?s2member_pro_ccbill_return=1&s2member_pro_ccbill_return_success=".rawurlencode(site_url("/thank-you/")))).'\\n\\n* For help on URL encoding, please see:\\nhttp://www.w3schools.com/tags/ref_urlencode.asp\'); return false;">example</a> ].</p>'."\n";
  290. echo '</div>'."\n";
  291.  
  292. echo '</div>'."\n";
  293.  
  294. echo '</div>'."\n";
  295.  
  296. echo '<div class="ws-menu-page-group" title="ccBill® IPN / Bg Post Integration">'."\n";
  297.  
  298. echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-ccbill-bg-post-section">'."\n";
  299. echo '<h3>ccBill® Background Post Integration (required)<br />aka: ccBill® IPN (Instant Payment Notifications)</h3>'."\n";
  300. echo '<p>Log into your ccBill® Client account and navigate to this section:<br /><code>Account Admin -› Advanced</code></p>'."\n";
  301. echo '<p>Your ccBill® Approval Post URL is:<br /><code>'.esc_html(site_url("/?s2member_pro_ccbill_notify=1")).'</code></p>'."\n";
  302. echo '<p>Your ccBill® Denial Post URL is:<br /><code>'.esc_html(site_url("/?s2member_pro_ccbill_notify=0")).'</code></p>'."\n";
  303. echo '</div>'."\n";
  304.  
  305. echo '</div>'."\n";
  306.  
  307. echo '<div class="ws-menu-page-group" title="Signup Confirmation Email (Standard)">'."\n";
  308.  
  309. echo '<div class="ws-menu-page-section ws-plugin--s2member-signup-confirmation-email-section">'."\n";
  310. echo '<h3>Signup Confirmation Email (required, but the default works fine)</h3>'."\n";
  311. echo '<p>This email is sent to new Customers after they return from a successful signup at ccBill®. The <strong>primary</strong> purpose of this email, is to provide the Customer with instructions, along with a link to register a Username for their Membership. You may also customize this further, by providing details that are specifically geared to your site.</p>'."\n";
  312. echo '<p><em><strong>*ccBill® Email Receipts (important change required)*</strong> In addition to this email, ccBill® also sends your Customer an <code>APPROVAL</code> Receipt. Inside this default Email Receipt that ccBill® sends to each of your Customers, there is a small section that includes a Username/Password; which is normally assigned by ccBill®. However, s2Member\'s integration requires that ccBill® User Management be turned <code>off</code> (i.e. s2Member deals with this instead) ... so you WILL need to remove the Username/Password section from the <code>APPROVAL</code> email inside your ccBill® account. In your ccBill® account, see: <code>Account Admin -› Custom Emails</code>.</em></p>'."\n";
  313.  
  314. echo '<p><em class="ws-menu-page-hilite">* The email configuration below is universally applied to all Payment Gateway integrations. [ <a href="#" onclick="alert(\'This configuration panel may ALSO appear under (s2Member -› PayPal® Options). Feel free to configure this email here; but please remember that this configuration is applied universally (i.e. SHARED) among all Payment Gateways integrated with s2Member.\'); return false;">?</a> ]</em></p>'."\n";
  315.  
  316. echo '<table class="form-table">'."\n";
  317. echo '<tbody>'."\n";
  318. echo '<tr>'."\n";
  319.  
  320. echo '<th>'."\n";
  321. echo '<label for="ws-plugin--s2member-signup-email-recipients">'."\n";
  322. echo 'Signup Confirmation Recipients:'."\n";
  323. echo '</label>'."\n";
  324. echo '</th>'."\n";
  325.  
  326. echo '</tr>'."\n";
  327. echo '<tr>'."\n";
  328.  
  329. echo '<td>'."\n";
  330. echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_signup_email_recipients" id="ws-plugin--s2member-signup-email-recipients" value="'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_email_recipients"]).'" /><br />'."\n";
  331. echo 'This is a semicolon ( ; ) delimited list of Recipients. Here is an example:<br />'."\n";
  332. echo '<code>"%%full_name%%" &lt;%%payer_email%%&gt;; admin@example.com; "Webmaster" &lt;webmaster@example.com&gt;</code>'."\n";
  333. echo '</td>'."\n";
  334.  
  335. echo '</tr>'."\n";
  336. echo '<tr>'."\n";
  337.  
  338. echo '<th>'."\n";
  339. echo '<label for="ws-plugin--s2member-signup-email-subject">'."\n";
  340. echo 'Signup Confirmation Email Subject:'."\n";
  341. echo '</label>'."\n";
  342. echo '</th>'."\n";
  343.  
  344. echo '</tr>'."\n";
  345. echo '<tr>'."\n";
  346.  
  347. echo '<td>'."\n";
  348. echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_signup_email_subject" id="ws-plugin--s2member-signup-email-subject" value="'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_email_subject"]).'" /><br />'."\n";
  349. echo 'Subject Line used in the email sent to a Customer after a successful signup has occurred through ccBill®.'."\n";
  350. echo '</td>'."\n";
  351.  
  352. echo '</tr>'."\n";
  353. echo '<tr>'."\n";
  354.  
  355. echo '<th>'."\n";
  356. echo '<label for="ws-plugin--s2member-signup-email-message">'."\n";
  357. echo 'Signup Confirmation Email Message:'."\n";
  358. echo '</label>'."\n";
  359. echo '</th>'."\n";
  360.  
  361. echo '</tr>'."\n";
  362. echo '<tr>'."\n";
  363.  
  364. echo '<td>'."\n";
  365. echo '<textarea name="ws_plugin__s2member_signup_email_message" id="ws-plugin--s2member-signup-email-message" rows="10">'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_email_message"]).'</textarea><br />'."\n";
  366. echo 'Message Body used in the email sent to a Customer after a successful signup has occurred through ccBill®.<br /><br />'."\n";
  367. echo '<strong>You can also use these special Replacement Codes if you need them:</strong>'."\n";
  368. echo '<ul>'."\n";
  369. echo '<li><code>%%registration_url%%</code> = The full URL (generated by s2Member) where the Customer can get registered.</li>'."\n";
  370. echo '<li><code>%%subscr_id%%</code> = The ccBill® Subscription ID as recorded in your ccBill® Merchant account. [ <a href="#" onclick="alert(\'If you are selling Lifetime or Fixed-Term (non-recurring) access, using Buy Now functionality with ccBill®; the %%subscr_id%% is actually set to the Transaction ID for the purchase. ccBill® does not provide a specific Subscription ID for Buy Now purchases. Since Lifetime &amp; Fixed-Term Subscriptions are NOT recurring (i.e. there is only ONE payment), using the Transaction ID as the Subscription ID is a graceful way to deal with this minor conflict.\'); return false;">?</a> ]</li>'."\n";
  371. echo '<li><code>%%initial%%</code> = The Initial Fee charged during signup. If you offered a 100% Free Trial, this will be <code>0</code>. [ <a href="#" onclick="alert(\'This will always represent the amount of money the Customer spent, whenever they initially signed up, no matter what. If a Customer signs up, under the terms of a 100% Free Trial Period, this will be 0.\'); return false;">?</a> ]</li>'."\n";
  372. echo '<li><code>%%regular%%</code> = The Regular Amount of the Subscription. This value is <code>always > 0</code>, no matter what. [ <a href="#" onclick="alert(\'This is how much the Subscription costs after an Initial Period expires. The %%regular%% rate is always > 0. If you did NOT offer an Initial Period at a different price, %%initial%% and %%regular%% will be equal to the same thing.\'); return false;">?</a> ]</li>'."\n";
  373. echo '<li><code>%%recurring%%</code> = This is the amount that will be charged on a recurring basis, or <code>0</code> if non-recurring. [ <a href="#" onclick="alert(\'If Recurring Payments have not been required, this will be equal to 0. That being said, %%regular%% &amp; %%recurring%% are usually the same value. This variable can be used in two different ways. You can use it to determine what the Regular Recurring Rate is, or to determine whether the Subscription will recur or not. If it is going to recur, %%recurring%% will be > 0.\'); return false;">?</a> ]</li>'."\n";
  374. echo '<li><code>%%first_name%%</code> = The First Name of the Customer who purchased the Membership Subscription.</li>'."\n";
  375. echo '<li><code>%%last_name%%</code> = The Last Name of the Customer who purchased the Membership Subscription.</li>'."\n";
  376. echo '<li><code>%%full_name%%</code> = The Full Name (First &amp; Last) of the Customer who purchased the Membership Subscription.</li>'."\n";
  377. echo '<li><code>%%payer_email%%</code> = The Email Address of the Customer who purchased the Membership Subscription.</li>'."\n";
  378. echo '<li><code>%%user_ip%%</code> = The Customer\'s IP Address, detected during checkout via <code>$_SERVER["REMOTE_ADDR"]</code>.</li>'."\n";
  379. echo '<li><code>%%item_number%%</code> = The Item Number (colon separated <code><em>level:custom_capabilities:fixed term</em></code>) that the Subscription is for.</li>'."\n";
  380. echo '<li><code>%%item_name%%</code> = The Item Name (as provided by the <code>desc=""</code> attribute in your Shortcode, which briefly describes the Item Number).</li>'."\n";
  381. echo '<li><code>%%initial_term%%</code> = This is the term length of the Initial Period. This will be a numeric value, followed by a space, then a single letter. [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%initial_term%% = 1 D (this means 1 Day)\\n%%initial_term%% = 1 W (this means 1 Week)\\n%%initial_term%% = 1 M (this means 1 Month)\\n%%initial_term%% = 1 Y (this means 1 Year)\\n\\nThe Initial Period never recurs, so this only lasts for the term length specified, then it is over.\'); return false;">?</a> ]</li>'."\n";
  382. echo '<li><code>%%initial_cycle%%</code> = This is the <code>%%initial_term%%</code> from above, converted to a cycle representation of: <code><em>X days/weeks/months/years</em></code>.</li>'."\n";
  383. echo '<li><code>%%regular_term%%</code> = This is the term length of the Regular Period. This will be a numeric value, followed by a space, then a single letter. [ <a href="#" onclick="alert(\'Here are some examples:\\n\\n%%regular_term%% = 1 D (this means 1 Day)\\n%%regular_term%% = 1 W (this means 1 Week)\\n%%regular_term%% = 1 M (this means 1 Month)\\n%%regular_term%% = 1 Y (this means 1 Year)\\n%%regular_term%% = 1 L (this means 1 Lifetime)\\n\\nThe Regular Term is usually recurring. So the Regular Term value represents the period (or duration) of each recurring period. If %%recurring%% = 0, then the Regular Term only applies once, because it is not recurring. So if it is not recurring, the value of %%regular_term%% simply represents how long their Membership privileges are going to last after the %%initial_term%% has expired, if there was an Initial Term. The value of this variable ( %%regular_term%% ) will never be empty, it will always be at least: 1 D, meaning 1 day. No exceptions.\'); return false;">?</a> ]</li>'."\n";
  384. echo '<li><code>%%regular_cycle%%</code> = This is the <code>%%regular_term%%</code> from above, converted to a cycle representation of: <code><em>[every] X days/weeks/months/years — OR daily, weekly, bi-weekly, monthly, bi-monthly, quarterly, yearly, or lifetime</em></code>. This is a very useful Replacment Code. Its value is dynamic; depending on term length, recurring status, and period/term lengths configured.</li>'."\n";
  385. echo '<li><code>%%recurring/regular_cycle%%</code> = Example (<code>14.95 / Monthly</code>), or ... (<code>0 / non-recurring</code>); depending on the value of <code>%%recurring%%</code>.</li>'."\n";
  386. echo '</ul>'."\n";
  387.  
  388. echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>'."\n";
  389. echo '<ul>'."\n";
  390. echo '<li><code>%%cv0%%</code> = The domain of your site, which is passed through the `custom` attribute in your Shortcode.</li>'."\n";
  391. echo '<li><code>%%cv1%%</code> = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute; inside your Shortcode, like this: <code>custom="'.esc_html($_SERVER["HTTP_HOST"]).'|cv1|cv2|cv3"</code>. You can have an unlimited number of custom variables. Obviously, this is for advanced webmasters; but the functionality has been made available for those who need it.</li>'."\n";
  392. echo '</ul>'."\n";
  393. echo '<strong>This example uses cv1 to record a special marketing campaign:</strong><br />'."\n";
  394. echo '<em>(The campaign (i.e. christmas-promo) could be referenced using <code>%%cv1%%</code>)</em><br />'."\n";
  395. echo '<code>custom="'.esc_html($_SERVER["HTTP_HOST"]).'|christmas-promo"</code>'."\n";
  396.  
  397. echo (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ()) ?
  398. '<div class="ws-menu-page-hr"></div>' . "\n".
  399. '<p style="margin:0;"><strong>PHP Code:</strong> It is also possible to use PHP tags — optional (for developers). If you use PHP tags, please run a test email with <code>&lt;?php print_r(get_defined_vars()); ?&gt;</code>. This will give you a full list of all PHP variables available to you in this email. The <code>$paypal</code> variable is the most important one. It contains all of the <code>$_POST</code> variables received from ccBill\'s Bg Post/IPN service, which are then translated into a format that s2Member\'s Core PayPal® Processor can understand (e.g. <code>$paypal["item_number"]</code>, <code>$paypal["item_name"]</code>, etc). Please note that all Replacement Codes will be parsed first, and then any PHP tags that you\'ve included. Also, please remember that emails are sent in plain text format.</p>'."\n"
  400. : '';
  401. echo '</td>'."\n";
  402.  
  403. echo '</tr>'."\n";
  404. echo '</tbody>'."\n";
  405. echo '</table>'."\n";
  406. echo '</div>'."\n";
  407.  
  408. echo '</div>'."\n";
  409.  
  410. echo '<div class="ws-menu-page-group" title="Specific Post/Page Confirmation Email (Standard)">'."\n";
  411.  
  412. echo '<div class="ws-menu-page-section ws-plugin--s2member-sp-confirmation-email-section">'."\n";
  413. echo '<h3>Specific Post/Page Confirmation Email (required, but the default works fine)</h3>'."\n";
  414. echo '<p>This email is sent to new Customers after they return from a successful purchase at ccBill®, for Specific Post/Page Access. (see: <code>s2Member -› Restriction Options -› Specific Post/Page Access</code>). This is NOT used for Membership sales, only for Specific Post/Page Access. The <strong>primary</strong> purpose of this email, is to provide the Customer with instructions, along with a link to access the Specific Post/Page they\'ve purchased access to. If you\'ve created a Specific Post/Page Package (with multiple Posts/Pages bundled together into one transaction), this ONE link (<code>%%sp_access_url%%</code>) will automatically authenticate them for access to ALL of the Posts/Pages included in their transaction. You may customize this email further, by providing details that are specifically geared to your site.</p>'."\n";
  415. echo '<p><em><strong>*ccBill® Email Receipts (important change required)*</strong> In addition to this email, ccBill® also sends your Customer an <code>APPROVAL</code> Receipt. Inside this default Email Receipt that ccBill® sends to each of your Customers, there is a small section that includes a Username/Password; which is normally assigned by ccBill®. However, s2Member\'s integration requires that ccBill® User Management be turned <code>off</code> (i.e. s2Member deals with Specific Post/Page authentication differently) ... so you WILL need to remove the Username/Password section from the <code>APPROVAL</code> email inside your ccBill® account. In your ccBill® account, see: <code>Account Admin -› Custom Emails</code>.</em></p>'."\n";
  416.  
  417. echo '<p><em class="ws-menu-page-hilite">* This email configuration is universally applied to all Payment Gateway integrations. [ <a href="#" onclick="alert(\'This configuration panel may ALSO appear under (s2Member -› PayPal® Options). Feel free to configure this email here; but please remember that this configuration is applied universally (i.e. SHARED) among all Payment Gateways integrated with s2Member.\'); return false;">?</a> ]</em></p>'."\n";
  418.  
  419. echo '<table class="form-table">'."\n";
  420. echo '<tbody>'."\n";
  421. echo '<tr>'."\n";
  422.  
  423. echo '<th>'."\n";
  424. echo '<label for="ws-plugin--s2member-sp-email-recipients">'."\n";
  425. echo 'Specific Post/Page Confirmation Recipients:'."\n";
  426. echo '</label>'."\n";
  427. echo '</th>'."\n";
  428.  
  429. echo '</tr>'."\n";
  430. echo '<tr>'."\n";
  431.  
  432. echo '<td>'."\n";
  433. echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_sp_email_recipients" id="ws-plugin--s2member-sp-email-recipients" value="'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_email_recipients"]).'" /><br />'."\n";
  434. echo 'This is a semicolon ( ; ) delimited list of Recipients. Here is an example:<br />'."\n";
  435. echo '<code>"%%full_name%%" &lt;%%payer_email%%&gt;; admin@example.com; "Webmaster" &lt;webmaster@example.com&gt;</code>'."\n";
  436. echo '</td>'."\n";
  437.  
  438. echo '</tr>'."\n";
  439. echo '<tr>'."\n";
  440.  
  441. echo '<th>'."\n";
  442. echo '<label for="ws-plugin--s2member-sp-email-subject">'."\n";
  443. echo 'Specific Post/Page Confirmation Email Subject:'."\n";
  444. echo '</label>'."\n";
  445. echo '</th>'."\n";
  446.  
  447. echo '</tr>'."\n";
  448. echo '<tr>'."\n";
  449.  
  450. echo '<td>'."\n";
  451. echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_sp_email_subject" id="ws-plugin--s2member-sp-email-subject" value="'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_email_subject"]).'" /><br />'."\n";
  452. echo 'Subject Line used in the email sent to a Customer after a successful purchase has occurred through ccBill®, for Specific Post/Page Access.'."\n";
  453. echo '</td>'."\n";
  454.  
  455. echo '</tr>'."\n";
  456. echo '<tr>'."\n";
  457.  
  458. echo '<th>'."\n";
  459. echo '<label for="ws-plugin--s2member-sp-email-message">'."\n";
  460. echo 'Specific Post/Page Confirmation Email Message:'."\n";
  461. echo '</label>'."\n";
  462. echo '</th>'."\n";
  463.  
  464. echo '</tr>'."\n";
  465. echo '<tr>'."\n";
  466.  
  467. echo '<td>'."\n";
  468. echo '<textarea name="ws_plugin__s2member_sp_email_message" id="ws-plugin--s2member-sp-email-message" rows="10">'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_email_message"]).'</textarea><br />'."\n";
  469. echo 'Message Body used in the email sent to a Customer after a successful purchase has occurred through ccBill®, for Specific Post/Page Access.<br /><br />'."\n";
  470. echo '<strong>You can also use these special Replacement Codes if you need them:</strong>'."\n";
  471. echo '<ul>'."\n";
  472. echo '<li><code>%%sp_access_url%%</code> = The full URL (generated by s2Member) where the Customer can gain access.</li>'."\n";
  473. echo '<li><code>%%sp_access_exp%%</code> = Human readable expiration for <code>%%sp_access_url%%</code>. Ex: <em>(link expires in <code>%%sp_access_exp%%</code>)</em>.</li>'."\n";
  474. echo '<li><code>%%txn_id%%</code> = The ccBill® Transaction/Subscription ID. ccBill® assigns a unique identifier for every purchase.</li>'."\n";
  475. echo '<li><code>%%amount%%</code> = The full Amount that you charged for Specific Post/Page Access. This value will <code>always be > 0</code>.</li>'."\n";
  476. echo '<li><code>%%first_name%%</code> = The First Name of the Customer who purchased Specific Post/Page Access.</li>'."\n";
  477. echo '<li><code>%%last_name%%</code> = The Last Name of the Customer who purchased Specific Post/Page Access.</li>'."\n";
  478. echo '<li><code>%%full_name%%</code> = The Full Name (First &amp; Last) of the Customer who purchased Specific Post/Page Access.</li>'."\n";
  479. echo '<li><code>%%payer_email%%</code> = The Email Address of the Customer who purchased Specific Post/Page Access.</li>'."\n";
  480. echo '<li><code>%%user_ip%%</code> = The Customer\'s IP Address, detected during checkout via <code>$_SERVER["REMOTE_ADDR"]</code>.</li>'."\n";
  481. echo '<li><code>%%item_number%%</code> = The Item Number. Ex: <code><em>sp:13,24,36:72</em></code> (translates to: <code><em>sp:comma-delimited IDs:expiration hours</em></code>).</li>'."\n";
  482. echo '<li><code>%%item_name%%</code> = The Item Name (as provided by the <code>desc=""</code> attribute in your Shortcode, which briefly describes the Item Number).</li>'."\n";
  483. echo '</ul>'."\n";
  484.  
  485. echo '<strong>Custom Replacement Codes can also be inserted using these instructions:</strong>'."\n";
  486. echo '<ul>'."\n";
  487. echo '<li><code>%%cv0%%</code> = The domain of your site, which is passed through the `custom` attribute in your Shortcode.</li>'."\n";
  488. echo '<li><code>%%cv1%%</code> = If you need to track additional custom variables, you can pipe delimit them into the `custom` attribute; inside your Shortcode, like this: <code>custom="'.esc_html($_SERVER["HTTP_HOST"]).'|cv1|cv2|cv3"</code>. You can have an unlimited number of custom variables. Obviously, this is for advanced webmasters; but the functionality has been made available for those who need it.</li>'."\n";
  489. echo '</ul>'."\n";
  490. echo '<strong>This example uses cv1 to record a special marketing campaign:</strong><br />'."\n";
  491. echo '<em>(The campaign (i.e. christmas-promo) could be referenced using <code>%%cv1%%</code>)</em><br />'."\n";
  492. echo '<code>custom="'.esc_html($_SERVER["HTTP_HOST"]).'|christmas-promo"</code>'."\n";
  493.  
  494. echo (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ()) ?
  495. '<div class="ws-menu-page-hr"></div>' . "\n".
  496. '<p style="margin:0;"><strong>PHP Code:</strong> It is also possible to use PHP tags — optional (for developers). If you use PHP tags, please run a test email with <code>&lt;?php print_r(get_defined_vars()); ?&gt;</code>. This will give you a full list of all PHP variables available to you in this email. The <code>$paypal</code> variable is the most important one. It contains all of the <code>$_POST</code> variables received from ccBill\'s Bg Post/IPN service, which are then translated into a format that s2Member\'s Core PayPal® Processor can understand (e.g. <code>$paypal["item_number"]</code>, <code>$paypal["item_name"]</code>, etc). Please note that all Replacement Codes will be parsed first, and then any PHP tags that you\'ve included. Also, please remember that emails are sent in plain text format.</p>'."\n"
  497. : '';
  498. echo '</td>'."\n";
  499.  
  500. echo '</tr>'."\n";
  501. echo '</tbody>'."\n";
  502. echo '</table>'."\n";
  503. echo '</div>'."\n";
  504.  
  505. echo '</div>'."\n";
  506.  
  507. echo '<div class="ws-menu-page-group" title="Automatic EOT Behavior">'."\n";
  508.  
  509. echo '<div class="ws-menu-page-section ws-plugin--s2member-eot-behavior-section">'."\n";
  510. echo '<h3>ccBill® EOT Behavior (required, please choose)</h3>'."\n";
  511. echo '<p>EOT = End Of Term. By default, s2Member will demote a paid Member to a Free Subscriber whenever their Subscription term has ended (i.e. expired), been cancelled, refunded, charged back to you, etc. s2Member demotes them to a Free Subscriber, so they will no longer have Member Level Access to your site. However, in some cases, you may prefer to have Customer accounts deleted completely, instead of just being demoted. This is where you choose which method works best for your site. If you don\'t want s2Member to take ANY action at all, you can disable s2Member\'s EOT System temporarily, or even completely. There are also a few other configurable options here, so please read carefully. These options are all very important.</p>'."\n";
  512. echo '<p>The ccBill® DataLink service will assist in notifying s2Member whenever a refund or chargeback occurs. For example, if you issue a refund to an unhappy Customer through ccBill®, s2Member will eventually be notified by the ccBill® DataLink service <em>(with a 24-48 hour delay)</em>, and the account for that Customer will either be demoted to a Free Subscriber, or deleted automatically (based on your configuration). ~ Otherwise, under normal circumstances, s2Member will not process an EOT until the User has completely used up the time they paid for.</em></p>'."\n";
  513.  
  514. echo '<p id="ws-plugin--s2member-auto-eot-system-enabled-via-cron"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"] == 2 && (!function_exists("wp_cron") || !wp_get_schedule("ws_plugin__s2member_auto_eot_system__schedule"))) ? '' : ' style="display:none;"').'>If you\'d like to run s2Member\'s Auto-EOT System through a more traditional Cron Job; instead of through <code>WP-Cron</code>, you will need to configure a Cron Job through your server control panel; provided by your hosting company. Set the Cron Job to run <code>once about every 10 minutes to an hour</code>. You\'ll want to configure an HTTP Cron Job that loads this URL:<br /><code>'.esc_html(site_url("/?s2member_auto_eot_system_via_cron=1")).'</code></p>'."\n";
  515.  
  516. echo '<p><em class="ws-menu-page-hilite">* These options are universally applied to all Payment Gateway integrations. [ <a href="#" onclick="alert(\'These settings may ALSO appear under (s2Member -› PayPal® Options). Feel free to configure them here; but please remember that these configuration options are applied universally (i.e. they\\\'re SHARED) among all Payment Gateways integrated with s2Member.\'); return false;">?</a> ]</em></p>'."\n";
  517.  
  518. echo '<table class="form-table">'."\n";
  519. echo '<tbody>'."\n";
  520. echo '<tr>'."\n";
  521.  
  522. echo '<th>'."\n";
  523. echo '<label for="ws-plugin--s2member-auto-eot-system-enabled">'."\n";
  524. echo 'Enable s2Member\'s Auto-EOT System?'."\n";
  525. echo '</label>'."\n";
  526. echo '</th>'."\n";
  527.  
  528. echo '</tr>'."\n";
  529. echo '<tr>'."\n";
  530.  
  531. echo '<td>'."\n";
  532. echo '<select name="ws_plugin__s2member_auto_eot_system_enabled" id="ws-plugin--s2member-auto-eot-system-enabled">'."\n";
  533. // Very advanced conditionals here. If the Auto-EOT System is NOT running, or NOT fully configured, this will indicate that no option is set - as sort of a built-in acknowledgment/warning in the UI panel.
  534. echo (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"] == 1 && (!function_exists("wp_cron") || !wp_get_schedule("ws_plugin__s2member_auto_eot_system__schedule"))) || ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"] == 2 && (function_exists("wp_cron") && wp_get_schedule("ws_plugin__s2member_auto_eot_system__schedule"))) || (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"] && (function_exists("wp_cron") && wp_get_schedule("ws_plugin__s2member_auto_eot_system__schedule")))) ? '<option value=""></option>'."\n" : '';
  535. echo '<option value="1"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"] == 1 && function_exists("wp_cron") && wp_get_schedule("ws_plugin__s2member_auto_eot_system__schedule")) ? ' selected="selected"' : '').'>Yes (enable the Auto-EOT System through WP-Cron)</option>'."\n";
  536. echo (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) ? '<option value="2"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"] == 2 && (!function_exists("wp_cron") || !wp_get_schedule("ws_plugin__s2member_auto_eot_system__schedule"))) ? ' selected="selected"' : '').'>Yes (but, I\'ll run it with my own Cron Job)</option>'."\n" : '';
  537. echo '<option value="0"'.((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"] && (!function_exists("wp_cron") || !wp_get_schedule("ws_plugin__s2member_auto_eot_system__schedule"))) ? ' selected="selected"' : '').'>No (disable the Auto-EOT System)</option>'."\n";
  538. echo '</select><br />'."\n";
  539. echo 'Recommended setting: (<code>Yes / enable via WP-Cron</code>)'."\n";
  540. echo '</td>'."\n";
  541.  
  542. echo '</tr>'."\n";
  543. echo '<tr>'."\n";
  544.  
  545. echo '<th>'."\n";
  546. echo '<label for="ws-plugin--s2member-membership-eot-behavior">'."\n";
  547. echo 'Membership EOT Behavior (Demote or Delete)?'."\n";
  548. echo '</label>'."\n";
  549. echo '</th>'."\n";
  550.  
  551. echo '</tr>'."\n";
  552. echo '<tr>'."\n";
  553.  
  554. echo '<td>'."\n";
  555. echo '<select name="ws_plugin__s2member_membership_eot_behavior" id="ws-plugin--s2member-membership-eot-behavior">'."\n";
  556. echo '<option value="demote"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "demote") ? ' selected="selected"' : '').'>Demote (convert them to a Free Subscriber)</option>'."\n";
  557. echo '<option value="delete"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete") ? ' selected="selected"' : '').'>Delete (erase their account completely)</option>'."\n";
  558. echo '</select>'."\n";
  559. echo '</td>'."\n";
  560.  
  561. echo '</tr>'."\n";
  562. echo '<tr>'."\n";
  563.  
  564. echo '<th>'."\n";
  565. echo '<label for="ws-plugin--s2member-eots-remove-ccaps">'."\n";
  566. echo 'Membership EOTs also Remove all Custom Capabilities?'."\n";
  567. echo '</label>'."\n";
  568. echo '</th>'."\n";
  569.  
  570. echo '</tr>'."\n";
  571. echo '<tr>'."\n";
  572.  
  573. echo '<td>'."\n";
  574. echo '<select name="ws_plugin__s2member_eots_remove_ccaps" id="ws-plugin--s2member-eots-remove-ccaps">'."\n";
  575. echo '<option value="1"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eots_remove_ccaps"]) ? ' selected="selected"' : '').'>Yes (an EOT also results in the loss of any Custom Capabilities a User/Member may have)</option>'."\n";
  576. echo '<option value="0"'.((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eots_remove_ccaps"]) ? ' selected="selected"' : '').'>No (an EOT has no impact on any Custom Capabilities a User/Member may have)</option>'."\n";
  577. echo '</select><br />'."\n";
  578. echo '<em>NOTE: If Refunds/Reversals trigger an Immediate EOT (see setting below); Custom Capabilities will always be removed when/if a Refund or Reversal occurs. In other words, this setting is ignored for Refunds/Reversals (IF they trigger an Immediate EOT — based on your configuration below). If you prefer to review all Refunds/Reversals for yourself, please choose that option below.</em>'."\n";
  579. echo '</td>'."\n";
  580.  
  581. echo '</tr>'."\n";
  582. echo '<tr>'."\n";
  583.  
  584. echo '<th>'."\n";
  585. echo '<label for="ws-plugin--s2member-eot-grace-time">'."\n";
  586. echo 'EOT Grace Time (in seconds):'."\n";
  587. echo '</label>'."\n";
  588. echo '</th>'."\n";
  589.  
  590. echo '</tr>'."\n";
  591. echo '<tr>'."\n";
  592.  
  593. echo '<td>'."\n";
  594. echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_eot_grace_time" id="ws-plugin--s2member-eot-grace-time" value="'.format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_grace_time"]).'" /><br />'."\n";
  595. echo '<em>This is represented in seconds. For example, a value of: <code>86400</code> = 1 day. Your EOT Grace Time; is the amount of time you will offer as a grace period (if any). Most site owners will give customers an additional 24 hours of access; just to help avoid any negativity that may result from a customer losing access sooner than they might expect. You can disable EOT Grace Time by setting this to: <code>0</code>. Note: there is NO Grace Time applied when/if a Refund or Reversal occurs. If Refunds/Reversals trigger an Immediate EOT (see setting below); there is never any Grace Time applied in that scenario.</em>'."\n";
  596. echo '</td>'."\n";
  597.  
  598. echo '</tr>'."\n";
  599. echo '<tr>'."\n";
  600.  
  601. echo '<th>'."\n";
  602. echo '<label for="ws-plugin--s2member-triggers-immediate-eot">'."\n";
  603. echo 'Refunds/Reversals (trigger Immediate EOT)?'."\n";
  604. echo '</label>'."\n";
  605. echo '</th>'."\n";
  606.  
  607. echo '</tr>'."\n";
  608. echo '<tr>'."\n";
  609.  
  610. echo '<td>'."\n";
  611. echo '<select name="ws_plugin__s2member_triggers_immediate_eot" id="ws-plugin--s2member-triggers-immediate-eot">'."\n";
  612. echo '<option value="none"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["triggers_immediate_eot"] === "none") ? ' selected="selected"' : '').'>Neither (I\'ll review these two events manually)</option>'."\n";
  613. echo '<option value="refunds"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["triggers_immediate_eot"] === "refunds") ? ' selected="selected"' : '').'>Refunds (refunds ALWAYS trigger an Immediate EOT action)</option>'."\n";
  614. echo '<option value="reversals"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["triggers_immediate_eot"] === "reversals") ? ' selected="selected"' : '').'>Reversals (chargebacks ALWAYS trigger an Immediate EOT action)</option>'."\n";
  615. echo '<option value="refunds,reversals"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["triggers_immediate_eot"] === "refunds,reversals") ? ' selected="selected"' : '').'>Refunds/Reversals (ALWAYS trigger an Immediate EOT action)</option>'."\n";
  616. echo '</select><br />'."\n";
  617. echo '<em>This setting will <a href="#" onclick="alert(\'A Refund/Reversal Notification will ALWAYS be processed internally by s2Member, even if no action is taken by s2Member. This way you\\\'ll have the full ability to listen for these two events on your own; if you prefer (optional). For more information, check your Dashboard under: `s2Member -› API Notifications -› Refunds/Reversals`.\'); return false;">NOT impact</a> s2Member\'s internal API Notifications for Refund/Reversal events.</em>'."\n";
  618. echo '</td>'."\n";
  619.  
  620. echo '</tr>'."\n";
  621. echo '<tr>'."\n";
  622.  
  623. echo '<th>'."\n";
  624. echo '<label for="ws-plugin--s2member-eot-time-ext-behavior">'."\n";
  625. echo 'Fixed-Term Extensions (Auto-Extend)?'."\n";
  626. echo '</label>'."\n";
  627. echo '</th>'."\n";
  628.  
  629. echo '</tr>'."\n";
  630. echo '<tr>'."\n";
  631.  
  632. echo '<td>'."\n";
  633. echo '<select name="ws_plugin__s2member_eot_time_ext_behavior" id="ws-plugin--s2member-eot-time-ext-behavior">'."\n";
  634. echo '<option value="extend"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_time_ext_behavior"] === "extend") ? ' selected="selected"' : '').'>Yes (default, automatically extend any existing EOT Time)</option>'."\n";
  635. echo '<option value="reset"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_time_ext_behavior"] === "reset") ? ' selected="selected"' : '').'>No (do NOT extend; s2Member should reset EOT Time completely)</option>'."\n";
  636. echo '</select><br />'."\n";
  637. echo '<em>This setting will only affect Buy Now transactions for fixed-term lengths. By default, s2Member will automatically extend any existing EOT Time that a Customer may have. For example, if I buy one year of access, and then I buy another year of access (before my first year is totally used up); I end up with everything I paid you for (now over 1 year of access) if this is set to <code>Yes</code>. If this was set to <code>No</code>, the EOT Time would be reset when I make the second purchase; leaving me with only 1 year of access, starting the date of my second purchase.</em>'."\n";
  638. echo '</td>'."\n";
  639.  
  640. echo '</tr>'."\n";
  641. echo '</tbody>'."\n";
  642. echo '</table>'."\n";
  643. echo '</div>'."\n";
  644.  
  645. echo '</div>'."\n";
  646.  
  647. echo '<div class="ws-menu-page-hr"></div>'."\n";
  648.  
  649. echo '<p class="submit"><input type="submit" class="button-primary" value="Save All Changes" /></p>'."\n";
  650.  
  651. echo '</form>'."\n";
  652.  
  653. echo '</td>'."\n";
  654.  
  655. echo '<td class="ws-menu-page-table-r">'."\n";
  656. c_ws_plugin__s2member_menu_pages_rs::display();
  657. echo '</td>'."\n";
  658.  
  659. echo '</tr>'."\n";
  660. echo '</tbody>'."\n";
  661. echo '</table>'."\n";
  662.  
  663. echo '</div>'."\n";
  664. }
  665. }
  666. }
  667.  
  668. new c_ws_plugin__s2member_pro_menu_page_ccbill_ops();
  669. ?>

pro\s2member-pro\includes\menu-pages\ccbill-ops.inc.php

Source Code Documentation