PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.2.25
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.2.25
1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.23 All 172 releases
userswp / includes / class-notices.php

class-notices.php in UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP 1.2.25, at includes/class-notices.php

201 lines 8.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * UsersWP Notice display functions.
4 *
5 * All UsersWP notice display related functions can be found here.
6 *
7 * @since 1.0.0
8 * @author GeoDirectory Team <info@wpgeodirectory.com>
9 */
10 class UsersWP_Notices {
11
12 /**
13 * Displays notices when registration disabled.
14 *
15 * @since 1.0.0
16 * @package userswp
17 * @return void
18 */
19 function display_registration_disabled_notice($type) {
20 if ($type == 'register') {
21 if (!get_option('users_can_register')) {
22 echo aui()->alert(array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
23 'class' => 'text-center',
24 'type'=>'danger',
25 'heading' => esc_attr__( 'Heads Up!', 'userswp' ),
26 'content'=> esc_attr__( 'User registration is currently not allowed.', 'userswp' )
27 )
28 );
29 }
30 }
31 }
32
33 /**
34 * Displays noticed based on notice key.
35 *
36 * @param string $type
37 * @param bool $echo
38 *
39 * @return string
40 */
41 public function form_notice_by_key($type = '', $echo = true, $user_id = 0) {
42 $key = isset($_REQUEST['uwp_err']) ? sanitize_html_class($_GET['uwp_err']) : $type;
43 $user_id = isset($_REQUEST['user_id']) ? absint($_REQUEST['user_id']) : $user_id;
44 $messages = array();
45 $notice = $link = '';
46
47 $messages['act_success'] = array(
48 'message' => __('Account activated successfully. Please login to continue.', 'userswp'),
49 'type' => 'success',
50 );
51
52 if(isset($user_id) && !empty($user_id)){
53 $resend_link = uwp_get_login_page_url();
54 $resend_link = add_query_arg(
55 array(
56 'user_id' => $user_id,
57 'action' => 'uwp_resend',
58 '_nonce' => wp_create_nonce('uwp_resend'),
59 ),
60 $resend_link
61 );
62
63 $link = "<a href='".esc_url_raw($resend_link)."' >".__('Resend', 'userswp')."</a>";
64 }
65
66 $messages['act_email_success'] = array(
67 'message' => __('Email updated successfully.', 'userswp'),
68 'type' => 'success',
69 );
70
71 $messages['act_pending'] = array(
72 'message' => __('Your account is not activated yet. Please check your email for activation email.', 'userswp').$link,
73 'type' => 'error',
74 );
75 $messages['act_error'] = array(
76 'message' => __('Invalid activation key or account.', 'userswp'),
77 'type' => 'error',
78 );
79 $messages['act_wrong'] = array(
80 'message' => __('Invalid activation key or account.', 'userswp'),
81 'type' => 'error',
82 );
83
84 $messages = apply_filters('uwp_form_error_messages', $messages, $echo, $user_id );
85
86 if (!empty($key) && isset($messages[$key])) {
87 $value = $messages[$key];
88 $message = $value['message'];
89 $type = $value['type'];
90 $notice = aui()->alert(array(
91 'type'=> $type,
92 'content'=> $message
93 )
94 );
95
96 }
97
98 if($notice && $echo){
99 echo $notice; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
100 }else{
101 return $notice;
102 }
103
104 }
105
106 public function show_admin_notices() {
107 settings_errors( 'uwp-notices' );
108
109 include_once dirname( __FILE__ ) . '/class-uwp-background-updater.php';
110 $updater = new UsersWP_Background_Updater();
111 if ( $updater->is_updating() || ! empty( $_GET['force_sync_data'] ) ) {
112 ?>
113 <div id="message" class="updated notice notice-alt uwp-message">
114 <p><strong><?php esc_attr_e( 'UsersWP data sync', 'userswp' ); ?></strong> &#8211; <?php esc_attr_e( 'Users data sync is running in the background.', 'userswp' ); ?> <a href="<?php echo esc_url( add_query_arg( array( 'force_sync_data' => 'true', '_nonce' => wp_create_nonce( 'force_sync_data' ) ), admin_url( 'admin.php?page=userswp' ) ) ); ?>"><?php esc_attr_e( 'Taking a while? Click here to run it now.', 'userswp' ); ?></a></p>
115 </div>
116 <?php
117 }
118 }
119
120 /**
121 * Displays admin side notice to try Bootstrap layout
122 *
123 * @since 2.0.0
124 * @package userswp
125 *
126 * @return void
127 */
128 public static function try_bootstrap(){
129 $show = get_option("uwp_notice_try_bootstrap");
130 if( $show && uwp_get_option('design_style','bootstrap') != 'bootstrap'){
131 $settings_link = admin_url("admin.php?page=userswp&tab=general&section=developer&try-bootstrap=true");
132 // set the setting on the fly if set to do so
133 if(is_admin() && current_user_can( 'manage_options' ) && isset($_REQUEST['page']) && $_REQUEST['page']=='userswp' && !empty($_REQUEST['try-bootstrap']) ){
134 uwp_update_option('design_style','bootstrap');
135 ?>
136 <div class="notice notice-success">
137 <p><strong>UsersWP - </strong><?php esc_attr_e( 'Congratulations your site is now set to use the new Bootstrap styles!', 'userswp' ); ?></p>
138 </div>
139 <?php
140 }else{
141 ?>
142 <div class="notice notice-info is-dismissible uwp-notice-try-bootstrap">
143 <p><strong>UsersWP - </strong><?php esc_attr_e( 'Try our exciting new bootstrap styling for a more modern and clean look (switch back at any time).', 'userswp' ); ?>
144 <a href="<?php echo esc_url_raw( $settings_link );?>" class="button button-primary"><?php esc_attr_e( 'Try Now', 'userswp' ); ?></a>
145 </p>
146 </div>
147 <script>
148 jQuery(function() {
149 setTimeout(function(){
150 jQuery('.uwp-notice-try-bootstrap .notice-dismiss').click(function(){
151 jQuery.post("<?php echo esc_url( admin_url("admin-ajax.php?action=uwp_notice_clear_try_bootstrap")); ?>", function(data, status){
152 });
153 });
154 }, 300);
155 });
156 </script>
157 <?php
158 }
159
160 }
161
162 }
163
164 public static function yoast_user_archives_disabled(){
165 if( !current_user_can( 'manage_options' ) ) {
166 return;
167 }
168
169 if( defined( 'WPSEO_VERSION' ) && version_compare( WPSEO_VERSION, '7.0', '>=' ) && class_exists('WPSEO_Options') && WPSEO_Options::get( 'disable-author', false ) ){
170 $settings_link = admin_url("admin.php?page=wpseo_page_settings#/author-archives");
171
172 $profile_page_id = uwp_get_page_id( 'profile_page' );
173 if ($profile_page_id > 0 && ( $page_object = get_post( $profile_page_id ) )) {
174 if ('page' === $page_object->post_type && in_array($page_object->post_status, array('publish'))) {
175 if ( !get_user_meta( get_current_user_id(), 'uwp_seo_author_disabled_notice_dismissed' ) ) {
176 ?>
177 <div class="notice notice-error">
178 <p><strong>UsersWP
179 - </strong><?php esc_attr_e( 'Yoast SEO has disabled user profiles, please enable them.', 'userswp' ); ?>
180 <a href="<?php echo esc_url_raw( $settings_link ); ?>"
181 class="button button-primary"><?php esc_attr_e( 'View Settings', 'userswp' ); ?></a>
182 <a href="<?php echo esc_url( add_query_arg('uwp-seo-notice-dismissed', 1, uwp_current_page_url()) ); ?>"
183 class="button button-primary"><?php esc_attr_e( 'Dismiss', 'userswp' ); ?></a>
184 </p>
185 </div>
186 <?php
187 }
188 }
189 }
190 }
191
192 }
193
194 public function admin_init_handler(){
195 $user_id = get_current_user_id();
196 if ( isset( $_GET['uwp-seo-notice-dismissed'] ) ) {
197 add_user_meta( $user_id, 'uwp_seo_author_disabled_notice_dismissed', 'true', true );
198 }
199 }
200
201 }