PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 4.0.3
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v4.0.3
4.17.2 4.17.1 4.17.0 4.16.19 4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / src / Classes / AdminNotices.php
wp-user-avatar / src / Classes Last commit date
Installer 5 years ago AdminNotices.php 4 years ago AjaxHandler.php 4 years ago Autologin.php 4 years ago BuddyPressBbPress.php 5 years ago EditUserProfile.php 4 years ago ExtensionManager.php 4 years ago FileUploader.php 4 years ago FormPreviewHandler.php 5 years ago FormRepository.php 4 years ago FormShortcodeDefaults.php 5 years ago GDPR.php 4 years ago Geolocation.php 4 years ago GlobalSiteAccess.php 4 years ago ImageUploader.php 4 years ago LoginAuth.php 4 years ago Miscellaneous.php 4 years ago ModifyRedirectDefaultLinks.php 4 years ago PPRESS_Session.php 4 years ago PROFILEPRESS_sql.php 4 years ago PasswordReset.php 4 years ago ProfileUrlRewrite.php 4 years ago RegistrationAuth.php 4 years ago SendEmail.php 4 years ago ShortcodeThemeFactory.php 5 years ago UserAvatar.php 4 years ago UserSignupLocationListingPage.php 4 years ago UsernameEmailRestrictLogin.php 4 years ago WPProfileFieldParserTrait.php 4 years ago WelcomeEmailAfterSignup.php 4 years ago default-email-template.php 4 years ago index.php 5 years ago
AdminNotices.php
256 lines
1 <?php
2
3 namespace ProfilePress\Core\Classes;
4
5 use ProfilePressVendor\PAnD;
6
7 class AdminNotices
8 {
9 public function __construct()
10 {
11 add_action('admin_init', function () {
12
13 if (ppress_is_admin_page()) {
14 remove_all_actions('admin_notices');
15 }
16
17 add_action('admin_notices', [$this, 'admin_notices_bucket']);
18
19 add_filter('removable_query_args', [$this, 'removable_query_args']);
20 });
21
22 if (class_exists('\ProfilePressVendor\PAnD')) {
23 // persist admin notice dismissal initialization
24 add_action('admin_init', array('ProfilePressVendor\PAnD', 'init'));
25 add_action('wp_ajax_dismiss_admin_notice', ['ProfilePressVendor\PAnD', 'dismiss_admin_notice']);
26 }
27 add_action('admin_init', array($this, 'act_on_request'));
28
29 add_filter('admin_body_class', [$this, 'add_admin_body_class']);
30 }
31
32 public function add_admin_body_class($classes)
33 {
34 $current_screen = get_current_screen();
35
36 if (empty ($current_screen)) return $classes;
37
38 if (false !== strpos($current_screen->id, 'ppress-')) {
39 // Leave space on both sides so other plugins do not conflict.
40 $classes .= ' ppress-admin ';
41 }
42
43 return $classes;
44 }
45
46 public function admin_notices_bucket()
47 {
48 do_action('ppress_admin_notices');
49
50 $this->test_mode_notice();
51
52 $this->seo_friendly_permalink_not_set();
53
54 $this->registration_disabled_notice();
55
56 $this->create_plugin_pages();
57
58 $this->review_plugin_notice();
59
60 $this->wp_user_avatar_now_ppress_notice();
61 }
62
63 public function act_on_request()
64 {
65 if ( ! empty($_GET['ppress_admin_action'])) {
66
67 if ($_GET['ppress_admin_action'] == 'dismiss_leave_review_forever') {
68 update_option('ppress_dismiss_leave_review_forever', true);
69 }
70
71 if ($_GET['ppress_admin_action'] == 'dismiss_wp_user_avatar_now_ppress') {
72
73 PAnD::set_admin_notice_cache('wp_user_avatar_now_ppress_notice', 'forever');
74 }
75
76 wp_safe_redirect(esc_url_raw(remove_query_arg('ppress_admin_action')));
77 exit;
78 }
79 }
80
81 public function test_mode_notice()
82 {
83 if (ppress_is_test_mode() && current_user_can('manage_options')) {
84 $link = add_query_arg(
85 ['view' => 'payments', 'section' => 'payment-methods'],
86 PPRESS_SETTINGS_SETTING_PAGE
87 );
88
89 $notice = sprintf(__('<strong>Important:</strong> No real payment is being processed because ProfilePress is in test mode. Go to <a href="%s">Payment method settings</a> to disable test mode.', 'wp-user-avatar'), $link);
90 ?>
91 <div class="notice notice-warning">
92 <p><?php echo $notice; ?></p>
93 </div>
94 <?php
95 }
96 }
97
98 /**
99 * Display one-time admin notice to review plugin at least 7 days after installation
100 */
101 public function review_plugin_notice()
102 {
103 if ( ! PAnD::is_admin_notice_active('ppress-review-plugin-notice-forever')) return;
104
105 if (get_option('ppress_dismiss_leave_review_forever', false)) return;
106
107 $install_date = get_option('ppress_install_date', '');
108
109 if (empty($install_date)) return;
110
111 $diff = round((time() - strtotime($install_date)) / 24 / 60 / 60);
112
113 if ($diff < 7) return;
114
115 $review_url = 'https://wordpress.org/support/plugin/wp-user-avatar/reviews/?filter=5#new-post';
116
117 $dismiss_url = esc_url(add_query_arg('ppress_admin_action', 'dismiss_leave_review_forever'));
118
119 $notice = sprintf(
120 __('Hey, I noticed you have been using ProfilePress for at least 7 days now - that\'s awesome! Could you please do us a BIG favor and give it a %1$s5-star rating on WordPress?%2$s This will help us spread the word and boost our motivation - thanks!', 'wp-user-avatar'),
121 '<a href="' . $review_url . '" target="_blank">',
122 '</a>'
123 );
124 $label = __('Sure! I\'d love to give a review', 'wp-user-avatar');
125
126 $dismiss_label = __('Dismiss Forever', 'wp-user-avatar');
127
128 $notice .= "<div style=\"margin:10px 0 0;\"><a href=\"$review_url\" target='_blank' class=\"button-primary\">$label</a></div>";
129 $notice .= "<div style=\"margin:10px 0 0;\"><a href=\"$dismiss_url\">$dismiss_label</a></div>";
130
131 echo '<div data-dismissible="ppress-review-plugin-notice-forever" class="update-nag notice notice-warning is-dismissible">';
132 echo "<p>$notice</p>";
133 echo '</div>';
134 }
135
136 public function seo_friendly_permalink_not_set()
137 {
138 if ( ! PAnD::is_admin_notice_active('ppress_seo_friendly_permalink_not_set-2')) return;
139
140 if (is_admin() && current_user_can('administrator') && ! get_option('permalink_structure')) {
141
142 $change_permalink_button = sprintf(
143 '<a class="button" href="%s">%s</a>',
144 admin_url('options-permalink.php'),
145 __('Change Permalink Structure', 'wp-user-avatar')
146 );
147
148 $notice = sprintf(
149 __("Your site permalink structure is currently set to <code>Plain</code>. This setting is not compatible with ProfilePress. Change your permalink structure to any other setting to avoid issues. We recommend <code>Post name</code>.</p><p>%s", 'wp-user-avatar'),
150 $change_permalink_button
151 );
152
153 echo '<div data-dismissible="ppress_seo_friendly_permalink_not_set-2" class="update-nag notice notice-warning is-dismissible">';
154 echo "<p>$notice</p>";
155 echo '</div>';
156 }
157 }
158
159 /**
160 * Let user avatar plugin users know it is now ProfilePress
161 */
162 public function wp_user_avatar_now_ppress_notice()
163 {
164 if ( ! PAnD::is_admin_notice_active('wp_user_avatar_now_ppress_notice-forever')) return;
165
166 if (get_option('ppress_is_from_wp_user_avatar', false) != 'true') return;
167
168 $dismiss_url = esc_url(add_query_arg('ppress_admin_action', 'dismiss_wp_user_avatar_now_ppress'));
169
170 $notice = sprintf(
171 __('Important news! %1$sWP User Avatar%2$s is now %1$sProfilePress%2$s. We added new features such as member directories, frontend user registration & login forms, user profile, content protection and more. %3$sCheck Them Out%5$s | %4$sDismiss Notice%5$s', 'wp-user-avatar'),
172 '<strong>', '</strong>',
173 '<a href="' . PPRESS_SETTINGS_SETTING_PAGE . '">', '<a href="' . $dismiss_url . '">', '</a>'
174 );
175
176 echo '<div data-dismissible="wp_user_avatar_now_ppress_notice-forever" class="update-nag notice notice-warning is-dismissible">';
177 echo "<p>$notice</p>";
178 echo '</div>';
179 }
180
181 public function create_plugin_pages()
182 {
183 if ( ! PAnD::is_admin_notice_active('ppress-create-plugin-pages-notice-forever')) {
184 return;
185 }
186
187 $create_page_url = esc_url(add_query_arg(['ppress_create_pages' => 'true', 'ppress_nonce' => wp_create_nonce('ppress_create_pages')]));
188
189 $class = 'notice notice-info is-dismissible';
190 $message = __('ProfilePress needs to create several pages (Checkout, Order Confirmation, User Profile, My Account, Registration, Login, Member Directory) to function correctly.', 'wp-user-avatar');
191 $buttons = sprintf(
192 '<a href="%s" class="button button-primary">%s</a> <a href="#" class="button-secondary dismiss-this">%s</a>',
193 $create_page_url, esc_html__('Create Pages', 'wp-user-avatar'), esc_html__('No Thanks', 'wp-user-avatar')
194 );
195
196 printf('<div data-dismissible="ppress-create-plugin-pages-notice-forever" class="%1$s"><p>%2$s</p><p>%3$s</p></div>', esc_attr($class), esc_html($message), $buttons);
197 }
198
199 /**
200 * Notice when user registration is disabled.
201 */
202 function registration_disabled_notice()
203 {
204 if ( ! current_user_can('manage_options')) return;
205
206 if (get_option('users_can_register') || apply_filters('ppress_remove_registration_disabled_notice', false)) {
207 return;
208 }
209
210 if ( ! class_exists('\ProfilePressVendor\PAnD')) return;
211
212 if ( ! PAnD::is_admin_notice_active('pp-registration-disabled-notice-forever')) {
213 return;
214 }
215
216 $url = is_multisite() ? network_admin_url('settings.php') : admin_url('options-general.php');
217
218 ?>
219 <div data-dismissible="pp-registration-disabled-notice-forever" id="message" class="updated notice is-dismissible">
220 <p>
221 <?php printf(__('User registration currently disabled. To enable, Go to <a href="%1$s">Settings -> General</a>, and under Membership, check "Anyone can register"', 'wp-user-avatar'), $url); ?>
222 . </p>
223 </div>
224 <?php
225 }
226
227 public function removable_query_args($args = [])
228 {
229 $args[] = 'settings-updated';
230 $args[] = 'rule-updated';
231 $args[] = 'settings-added';
232 $args[] = 'field-edited';
233 $args[] = 'field-added';
234 $args[] = 'updated-contact-info';
235 $args[] = 'form-added';
236 $args[] = 'form-edited';
237 $args[] = 'user-profile-added';
238 $args[] = 'user-profile-edited';
239 $args[] = 'melange-edited';
240 $args[] = 'melange-added';
241 $args[] = 'license';
242
243 return $args;
244 }
245
246 public static function get_instance()
247 {
248 static $instance = null;
249
250 if (is_null($instance)) {
251 $instance = new self();
252 }
253
254 return $instance;
255 }
256 }