PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 3.2.2
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v3.2.2
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 5 years ago FileUploader.php 4 years ago FormPreviewHandler.php 5 years ago FormRepository.php 4 years ago FormShortcodeDefaults.php 5 years ago GDPR.php 5 years ago GlobalSiteAccess.php 4 years ago ImageUploader.php 4 years ago LoginAuth.php 4 years ago Miscellaneous.php 5 years ago ModifyRedirectDefaultLinks.php 4 years ago PPRESS_Session.php 4 years ago PROFILEPRESS_sql.php 5 years ago PasswordReset.php 5 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 5 years ago UsernameEmailRestrictLogin.php 5 years ago WelcomeEmailAfterSignup.php 5 years ago default-email-template.php 5 years ago index.php 5 years ago
AdminNotices.php
236 lines
1 <?php
2
3 namespace ProfilePress\Core\Classes;
4
5 use 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('PAnD')) {
23 // persist admin notice dismissal initialization
24 add_action('admin_init', array('PAnD', 'init'));
25 }
26 add_action('admin_init', array($this, 'act_on_request'));
27
28 add_filter('admin_body_class', [$this, 'add_admin_body_class']);
29 }
30
31 public function add_admin_body_class($classes)
32 {
33 $current_screen = get_current_screen();
34
35 if (empty ($current_screen)) return $classes;
36
37 if (false !== strpos($current_screen->id, 'pp-')) {
38 // Leave space on both sides so other plugins do not conflict.
39 $classes .= ' ppress-admin ';
40 }
41
42 return $classes;
43 }
44
45 public function admin_notices_bucket()
46 {
47 do_action('ppress_admin_notices');
48
49 $this->seo_friendly_permalink_not_set();
50
51 $this->registration_disabled_notice();
52
53 $this->create_plugin_pages();
54
55 $this->review_plugin_notice();
56
57 $this->wp_user_avatar_now_ppress_notice();
58 }
59
60 public function act_on_request()
61 {
62 if ( ! empty($_GET['ppress_admin_action'])) {
63
64 if ($_GET['ppress_admin_action'] == 'dismiss_leave_review_forever') {
65 update_option('ppress_dismiss_leave_review_forever', true);
66 }
67
68 if ($_GET['ppress_admin_action'] == 'dismiss_wp_user_avatar_now_ppress') {
69
70 PAnD::set_admin_notice_cache('wp_user_avatar_now_ppress_notice', 'forever');
71 }
72
73 wp_safe_redirect(esc_url_raw(remove_query_arg('ppress_admin_action')));
74 exit;
75 }
76 }
77
78 /**
79 * Display one-time admin notice to review plugin at least 7 days after installation
80 */
81 public function review_plugin_notice()
82 {
83 if ( ! PAnD::is_admin_notice_active('ppress-review-plugin-notice-forever')) return;
84
85 if (get_option('ppress_dismiss_leave_review_forever', false)) return;
86
87 $install_date = get_option('ppress_install_date', '');
88
89 if (empty($install_date)) return;
90
91 $diff = round((time() - strtotime($install_date)) / 24 / 60 / 60);
92
93 if ($diff < 7) return;
94
95 $review_url = 'https://wordpress.org/support/plugin/wp-user-avatar/reviews/?filter=5#new-post';
96
97 $dismiss_url = esc_url(add_query_arg('ppress_admin_action', 'dismiss_leave_review_forever'));
98
99 $notice = sprintf(
100 __('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'),
101 '<a href="' . $review_url . '" target="_blank">',
102 '</a>'
103 );
104 $label = __('Sure! I\'d love to give a review', 'wp-user-avatar');
105
106 $dismiss_label = __('Dismiss Forever', 'wp-user-avatar');
107
108 $notice .= "<div style=\"margin:10px 0 0;\"><a href=\"$review_url\" target='_blank' class=\"button-primary\">$label</a></div>";
109 $notice .= "<div style=\"margin:10px 0 0;\"><a href=\"$dismiss_url\">$dismiss_label</a></div>";
110
111 echo '<div data-dismissible="ppress-review-plugin-notice-forever" class="update-nag notice notice-warning is-dismissible">';
112 echo "<p>$notice</p>";
113 echo '</div>';
114 }
115
116 public function seo_friendly_permalink_not_set()
117 {
118 if ( ! PAnD::is_admin_notice_active('ppress_seo_friendly_permalink_not_set-2')) return;
119
120 if (is_admin() && current_user_can('administrator') && ! get_option('permalink_structure')) {
121
122 $change_permalink_button = sprintf(
123 '<a class="button" href="%s">%s</a>',
124 admin_url('options-permalink.php'),
125 __('Change Permalink Structure', 'wp-user-avatar')
126 );
127
128 $notice = sprintf(
129 __("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'),
130 $change_permalink_button
131 );
132
133 echo '<div data-dismissible="ppress_seo_friendly_permalink_not_set-2" class="update-nag notice notice-warning is-dismissible">';
134 echo "<p>$notice</p>";
135 echo '</div>';
136 }
137 }
138
139 /**
140 * Let user avatar plugin users know it is now ProfilePress
141 */
142 public function wp_user_avatar_now_ppress_notice()
143 {
144 if ( ! PAnD::is_admin_notice_active('wp_user_avatar_now_ppress_notice-forever')) return;
145
146 if (get_option('ppress_is_from_wp_user_avatar', false) != 'true') return;
147
148 $dismiss_url = esc_url(add_query_arg('ppress_admin_action', 'dismiss_wp_user_avatar_now_ppress'));
149
150 $notice = sprintf(
151 __('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'),
152 '<strong>', '</strong>',
153 '<a href="' . PPRESS_SETTINGS_SETTING_PAGE . '">', '<a href="' . $dismiss_url . '">', '</a>'
154 );
155
156 echo '<div data-dismissible="wp_user_avatar_now_ppress_notice-forever" class="update-nag notice notice-warning is-dismissible">';
157 echo "<p>$notice</p>";
158 echo '</div>';
159 }
160
161 public function create_plugin_pages()
162 {
163 if ( ! PAnD::is_admin_notice_active('ppress-create-plugin-pages-notice-forever')) {
164 return;
165 }
166
167 $create_page_url = esc_url(add_query_arg(['ppress_create_pages' => 'true', 'ppress_nonce' => wp_create_nonce('ppress_create_pages')]));
168
169 $class = 'notice notice-info is-dismissible';
170 $message = __('ProfilePress needs to create several pages (User Profiles, My Account, Registration, Login, Password Reset, Member Directory) to function correctly.', 'wp-user-avatar');
171 $buttons = sprintf(
172 '<a href="%s" class="button button-primary">%s</a> <a href="#" class="button-secondary dismiss-this">%s</a>',
173 $create_page_url, esc_html__('Create Pages', 'wp-user-avatar'), esc_html__('No Thanks', 'wp-user-avatar')
174 );
175
176 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);
177 }
178
179 /**
180 * Notice when user registration is disabled.
181 */
182 function registration_disabled_notice()
183 {
184 if ( ! current_user_can('manage_options')) return;
185
186 if (get_option('users_can_register') || apply_filters('ppress_remove_registration_disabled_notice', false)) {
187 return;
188 }
189
190 if ( ! class_exists('PAnD')) return;
191
192 if ( ! PAnD::is_admin_notice_active('pp-registration-disabled-notice-forever')) {
193 return;
194 }
195
196 $url = is_multisite() ? network_admin_url('settings.php') : admin_url('options-general.php');
197
198 ?>
199 <div data-dismissible="pp-registration-disabled-notice-forever" id="message" class="updated notice is-dismissible">
200 <p>
201 <?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); ?>
202 . </p>
203 </div>
204 <?php
205 }
206
207 public function removable_query_args($args = [])
208 {
209 $args[] = 'settings-updated';
210 $args[] = 'rule-updated';
211 $args[] = 'settings-added';
212 $args[] = 'field-edited';
213 $args[] = 'field-added';
214 $args[] = 'updated-contact-info';
215 $args[] = 'form-added';
216 $args[] = 'form-edited';
217 $args[] = 'user-profile-added';
218 $args[] = 'user-profile-edited';
219 $args[] = 'melange-edited';
220 $args[] = 'melange-added';
221 $args[] = 'license';
222
223 return $args;
224 }
225
226 public static function get_instance()
227 {
228 static $instance = null;
229
230 if (is_null($instance)) {
231 $instance = new self();
232 }
233
234 return $instance;
235 }
236 }