PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 3.1
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v3.1
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
AdminNotices.php 5 years ago AjaxHandler.php 5 years ago Autologin.php 5 years ago BuddyPressBbPress.php 5 years ago EditUserProfile.php 5 years ago ExtensionManager.php 5 years ago FileUploader.php 5 years ago FormPreviewHandler.php 5 years ago FormRepository.php 5 years ago FormShortcodeDefaults.php 5 years ago GDPR.php 5 years ago GlobalSiteAccess.php 5 years ago ImageUploader.php 5 years ago LoginAuth.php 5 years ago Miscellaneous.php 5 years ago ModifyRedirectDefaultLinks.php 5 years ago PPRESS_Session.php 5 years ago PROFILEPRESS_sql.php 5 years ago PasswordReset.php 5 years ago ProfileUrlRewrite.php 5 years ago RegistrationAuth.php 5 years ago SendEmail.php 5 years ago ShortcodeThemeFactory.php 5 years ago UserAvatar.php 5 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
195 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
29 public function admin_notices_bucket()
30 {
31 do_action('ppress_admin_notices');
32
33 $this->registration_disabled_notice();
34
35 $this->create_plugin_pages();
36
37 $this->review_plugin_notice();
38
39 $this->wp_user_avatar_now_ppress_notice();
40 }
41
42 public function act_on_request()
43 {
44 if ( ! empty($_GET['ppress_admin_action'])) {
45
46 if ($_GET['ppress_admin_action'] == 'dismiss_leave_review_forever') {
47 update_option('ppress_dismiss_leave_review_forever', true);
48 }
49
50 if ($_GET['ppress_admin_action'] == 'dismiss_wp_user_avatar_now_ppress') {
51
52 PAnD::set_admin_notice_cache('wp_user_avatar_now_ppress_notice', 'forever');
53 }
54
55 wp_safe_redirect(esc_url_raw(remove_query_arg('ppress_admin_action')));
56 exit;
57 }
58 }
59
60 /**
61 * Display one-time admin notice to review plugin at least 7 days after installation
62 */
63 public function review_plugin_notice()
64 {
65 if ( ! PAnD::is_admin_notice_active('ppress-review-plugin-notice-forever')) return;
66
67 if (get_option('ppress_dismiss_leave_review_forever', false)) return;
68
69 $install_date = get_option('ppress_install_date', '');
70
71 if (empty($install_date)) return;
72
73 $diff = round((time() - strtotime($install_date)) / 24 / 60 / 60);
74
75 if ($diff < 7) return;
76
77 $review_url = 'https://wordpress.org/support/plugin/wp-user-avatar/reviews/?filter=5#new-post';
78
79 $dismiss_url = esc_url_raw(add_query_arg('ppress_admin_action', 'dismiss_leave_review_forever'));
80
81 $notice = sprintf(
82 __('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'),
83 '<a href="' . $review_url . '" target="_blank">',
84 '</a>'
85 );
86 $label = __('Sure! I\'d love to give a review', 'wp-user-avatar');
87
88 $dismiss_label = __('Dimiss Forever', 'wp-user-avatar');
89
90 $notice .= "<div style=\"margin:10px 0 0;\"><a href=\"$review_url\" target='_blank' class=\"button-primary\">$label</a></div>";
91 $notice .= "<div style=\"margin:10px 0 0;\"><a href=\"$dismiss_url\">$dismiss_label</a></div>";
92
93 echo '<div data-dismissible="ppress-review-plugin-notice-forever" class="update-nag notice notice-warning is-dismissible">';
94 echo "<p>$notice</p>";
95 echo '</div>';
96 }
97
98 /**
99 * Let user avatar plugin users know it is now ProfilePress
100 */
101 public function wp_user_avatar_now_ppress_notice()
102 {
103 if ( ! PAnD::is_admin_notice_active('wp_user_avatar_now_ppress_notice-forever')) return;
104
105 if (get_option('ppress_is_from_wp_user_avatar', false) != 'true') return;
106
107 $dismiss_url = esc_url_raw(add_query_arg('ppress_admin_action', 'dismiss_wp_user_avatar_now_ppress'));
108
109 $notice = sprintf(
110 __('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'),
111 '<strong>', '</strong>',
112 '<a href="' . PPRESS_SETTINGS_SETTING_PAGE . '">', '<a href="' . $dismiss_url . '">', '</a>'
113 );
114
115 echo '<div data-dismissible="wp_user_avatar_now_ppress_notice-forever" class="update-nag notice notice-warning is-dismissible">';
116 echo "<p>$notice</p>";
117 echo '</div>';
118 }
119
120 public function create_plugin_pages()
121 {
122 if ( ! PAnD::is_admin_notice_active('ppress-create-plugin-pages-notice-forever')) {
123 return;
124 }
125
126 $create_page_url = esc_url(add_query_arg(['ppress_create_pages' => 'true', 'ppress_nonce' => wp_create_nonce('ppress_create_pages')]));
127
128 $class = 'notice notice-info is-dismissible';
129 $message = __('ProfilePress needs to create several pages (User Profiles, My Account, Registration, Login, Password Reset, Member Directory) to function correctly.', 'wp-user-avatar');
130 $buttons = sprintf(
131 '<a href="%s" class="button button-primary">%s</a> <a href="#" class="button-secondary dismiss-this">%s</a>',
132 $create_page_url, esc_html__('Create Pages', 'wp-user-avatar'), esc_html__('No Thanks', 'wp-user-avatar')
133 );
134
135 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);
136 }
137
138 /**
139 * Notice when user registration is disabled.
140 */
141 function registration_disabled_notice()
142 {
143 if ( ! current_user_can('manage_options')) return;
144
145 if (get_option('users_can_register') || apply_filters('ppress_remove_registration_disabled_notice', false)) {
146 return;
147 }
148
149 if ( ! class_exists('PAnD')) return;
150
151 if ( ! PAnD::is_admin_notice_active('pp-registration-disabled-notice-forever')) {
152 return;
153 }
154
155 $url = is_multisite() ? network_admin_url('settings.php') : admin_url('options-general.php');
156
157 ?>
158 <div data-dismissible="pp-registration-disabled-notice-forever" id="message" class="updated notice is-dismissible">
159 <p>
160 <?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); ?>
161 . </p>
162 </div>
163 <?php
164 }
165
166 public function removable_query_args($args = [])
167 {
168 $args[] = 'settings-updated';
169 $args[] = 'rule-updated';
170 $args[] = 'settings-added';
171 $args[] = 'field-edited';
172 $args[] = 'field-added';
173 $args[] = 'updated-contact-info';
174 $args[] = 'form-added';
175 $args[] = 'form-edited';
176 $args[] = 'user-profile-added';
177 $args[] = 'user-profile-edited';
178 $args[] = 'melange-edited';
179 $args[] = 'melange-added';
180 $args[] = 'license';
181
182 return $args;
183 }
184
185 public static function get_instance()
186 {
187 static $instance = null;
188
189 if (is_null($instance)) {
190 $instance = new self();
191 }
192
193 return $instance;
194 }
195 }