PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / trunk
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions vtrunk
260913 260909 260829 260814 260805 110710 110731 110812 110815 110912 110913 110915 110926 110927 111002 111003 111011 111017 111029 111105 111206 111216 111220 120213 120219 All 188 releases
s2member / src / includes / classes / op-notices.inc.php

op-notices.inc.php in s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions trunk, at src/includes/classes/op-notices.inc.php

140 lines 6.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // @codingStandardsIgnoreFile
3 /**
4 * Option panel notices.
5 *
6 * Copyright: © 2009-2011
7 * {@link http://websharks-inc.com/ WebSharks, Inc.}
8 * (coded in the USA)
9 *
10 * Released under the terms of the GNU General Public License.
11 * You should have received a copy of the GNU General Public License,
12 * along with this software. In the main directory, see: /licensing/
13 * If not, see: {@link http://www.gnu.org/licenses/}.
14 *
15 * @package s2Member\Option_Notices
16 * @since 3.5
17 */
18 if(!defined('WPINC')) // MUST have WordPress.
19 exit ("Do not access this file directly.");
20
21 if (!class_exists ("c_ws_plugin__s2member_op_notices"))
22 {
23 /**
24 * Option panel notices.
25 *
26 * @package s2Member\Option_Notices
27 * @since 3.5
28 */
29 class c_ws_plugin__s2member_op_notices
30 {
31 /**
32 * Describes the General Option overrides for clarity.
33 *
34 * @package s2Member\Option_Notices
35 * @since 3.5
36 *
37 * @attaches-to ``add_action("load-options-general.php");``
38 *
39 * @return null
40 */
41 public static function general_ops_notice ()
42 {
43 global $pagenow; // Need this global variable.
44
45 do_action("ws_plugin__s2member_before_general_ops_notice", get_defined_vars ());
46
47 if (is_blog_admin () && $pagenow === "options-general.php" && !isset ($_GET["page"]) && !is_multisite ()) // Multisite does NOT provide these options.
48 {
49 $notice = "<em>* Note: The s2Member plugin has control over two options on this page.<br /><code>Anyone Can Register = " . esc_html (get_option ("users_can_register")) . "</code>, and <code>New User Default Role = " . esc_html (get_option ("default_role")) . "</code>.<br />For further details, see: <strong>s2Member → General Options → Open Registration</strong>.</em>";
50
51 $js = '<script type="text/javascript">';
52 $js .= "jQuery(document).ready(function(\$){ \$('input#users_can_register, select#default_role').attr('disabled', 'disabled'); });";
53 $js .= '</script>';
54
55 do_action("ws_plugin__s2member_during_general_ops_notice", get_defined_vars ());
56
57 c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice . $js, "blog:" . $pagenow);
58 }
59
60 do_action("ws_plugin__s2member_after_general_ops_notice", get_defined_vars ());
61
62 return /* Return for uniformity. */;
63 }
64 /**
65 * Describes the Multisite Option overrides for clarity.
66 *
67 * @package s2Member\Option_Notices
68 * @since 3.5
69 *
70 * @attaches-to ``add_action("load-settings.php");``
71 *
72 * @return null
73 */
74 public static function multisite_ops_notice ()
75 {
76 global $pagenow; // Need this global variable.
77
78 do_action("ws_plugin__s2member_before_multisite_ops_notice", get_defined_vars ());
79
80 if (is_multisite () && is_network_admin () && in_array($pagenow, array("settings.php")) && !isset ($_GET["page"]))
81 {
82 $notice = "<em>* Note: The s2Member plugin has control over two options on this page.<br /><code>Allow Open Registration = " . esc_html (get_site_option ("registration")) . "</code> and <code>Add New Users = " . esc_html (get_site_option ("add_new_users")) . "</code>.<br />Please check: <strong>s2Member → Multisite (Config)</strong>.</em>";
83
84 $js = '<script type="text/javascript">';
85 $js .= "jQuery(document).ready(function(\$){ \$('input[name=registration], input#add_new_users').attr('disabled', 'disabled'); });";
86 $js .= '</script>';
87
88 do_action("ws_plugin__s2member_during_multisite_ops_notice", get_defined_vars ());
89
90 c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice . $js, "network:" . $pagenow);
91 }
92
93 do_action("ws_plugin__s2member_after_multisite_ops_notice", get_defined_vars ());
94
95 return /* Return for uniformity. */;
96 }
97 /**
98 * Deals with Reading Option conflicts.
99 *
100 * @package s2Member\Option_Notices
101 * @since 3.5
102 *
103 * @attaches-to ``add_action("load-options-reading.php");``
104 *
105 * @return null
106 */
107 public static function reading_ops_notice ()
108 {
109 global $pagenow; // Need this global variable.
110
111 do_action("ws_plugin__s2member_before_reading_ops_notice", get_defined_vars ());
112
113 if (is_blog_admin () && $pagenow === "options-reading.php" && !isset ($_GET["page"]))
114 {
115 do_action("ws_plugin__s2member_during_reading_ops_notice", get_defined_vars ()); // Now check for conflicts.
116
117 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && (string)get_option ("page_on_front") === $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]
118 && ($notice = '<strong>NOTE:</strong> Your Membership Options Page for s2Member is currently configured as your Home Page (i.e., static page) for WordPress. This causes internal conflicts with s2Member. Your Membership Options Page MUST stand alone. Please correct this.'))
119 c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:" . $pagenow, true);
120
121 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && (string)get_option ("page_on_front") === $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]
122 && ($notice = '<strong>NOTE:</strong> Your Login Welcome Page for s2Member is currently configured as your Home Page (i.e., static page) for WordPress. This causes internal conflicts with s2Member. Your Login Welcome Page MUST stand alone. Please correct this.'))
123 c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:" . $pagenow, true);
124
125 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && (string)get_option ("page_for_posts") === $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]
126 && ($notice = '<strong>NOTE:</strong> Your Membership Options Page for s2Member is currently configured as your Posts Page (i.e., static page) for WordPress. This causes internal conflicts with s2Member. Your Membership Options Page MUST stand alone. Please correct this.'))
127 c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:" . $pagenow, true);
128
129 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && (string)get_option ("page_for_posts") === $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]
130 && ($notice = '<strong>NOTE:</strong> Your Login Welcome Page for s2Member is currently configured as your Posts Page (i.e., static page) for WordPress. This causes internal conflicts with s2Member. Your Login Welcome Page MUST stand alone. Please correct this.'))
131 c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:" . $pagenow, true);
132 }
133
134 do_action("ws_plugin__s2member_after_reading_ops_notice", get_defined_vars ());
135
136 return /* Return for uniformity. */;
137 }
138 }
139 }
140