PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 2.7.1
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v2.7.1
4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 All 340 releases
profile-builder / assets / misc / plugin-compatibilities.php

plugin-compatibilities.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 2.7.1, at assets/misc/plugin-compatibilities.php

315 lines 13.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * This file has the sole purpose to help solve compatibility issues with other plugins
4 *
5 */
6
7
8 /****************************************************
9 * Plugin Name: Captcha
10 * Plugin URI: https://wordpress.org/plugins/captcha/
11 ****************************************************/
12
13 /*
14 * Function that ads the Captcha HTML to Profile Builder login form
15 *
16 */
17 if( function_exists('cptch_display_captcha_custom') ) {
18 function wppb_captcha_add_form_login($form_part, $args) {
19
20 $cptch_options = get_option('cptch_options');
21 if( !empty( $cptch_options['cptch_login_form'] ) && 1 == $cptch_options['cptch_login_form'] )
22 $form_part .= cptch_display_captcha_custom();
23 elseif( !empty( $cptch_options['forms']['wp_login']['enable'] ) && $cptch_options['forms']['wp_login']['enable'] )
24 $form_part .= cptch_display_captcha_custom();
25
26 return $form_part;
27 }
28
29 add_filter('login_form_middle', 'wppb_captcha_add_form_login', 10, 2);
30 }
31
32
33 /*
34 * Function that ads the Captcha HTML to Profile Builder form builder
35 *
36 */
37 if( function_exists('cptch_display_captcha_custom') ) {
38
39 function wppb_captcha_add_form_form_builder( $output, $form_location = '' ) {
40
41 if ( $form_location == 'register' ) {
42 $cptch_options = get_option('cptch_options');
43
44 if (!empty( $cptch_options['cptch_register_form'] ) && 1 == $cptch_options['cptch_register_form']) {
45 $output = '<li>' . cptch_display_captcha_custom() . '</li>' . $output;
46 }
47 elseif( !empty( $cptch_options['forms']['wp_register']['enable'] ) && $cptch_options['forms']['wp_register']['enable'] )
48 $output = '<li>' . cptch_display_captcha_custom() . '</li>' . $output;
49 }
50
51
52 return $output;
53 }
54
55 add_filter( 'wppb_after_form_fields', 'wppb_captcha_add_form_form_builder', 10, 2 );
56 }
57
58
59 /*
60 * Function that displays the Captcha error on register form
61 *
62 */
63 if( function_exists('cptch_register_check') ) {
64
65 function wppb_captcha_register_form_display_error() {
66
67 $cptch_options = get_option('cptch_options');
68
69 if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'register' && ( ( !empty( $cptch_options['cptch_register_form'] ) && 1 == $cptch_options['cptch_register_form'] ) || ( !empty( $cptch_options['forms']['wp_register']['enable'] ) && $cptch_options['forms']['wp_register']['enable'] ) ) ) {
70
71 $result = cptch_register_check(new WP_Error());
72
73 if ($result->get_error_message('captcha_error'))
74 echo '<p class="wppb-error">' . $result->get_error_message('captcha_error') . '</p>';
75
76 }
77
78 }
79
80 add_action('wppb_before_register_fields', 'wppb_captcha_register_form_display_error' );
81 }
82
83 /*
84 * Function that validates captcha value on register form
85 *
86 */
87 if( function_exists('cptch_register_check') ) {
88
89 function wppb_captcha_register_form_check_value($output_field_errors) {
90
91 $cptch_options = get_option('cptch_options');
92
93 if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'register' && ( ( !empty( $cptch_options['cptch_register_form'] ) && 1 == $cptch_options['cptch_register_form'] ) || ( !empty( $cptch_options['forms']['wp_register']['enable'] ) && $cptch_options['forms']['wp_register']['enable'] ) ) ) {
94
95 $result = cptch_register_check(new WP_Error() );
96
97 if ($result->get_error_message('captcha_error'))
98 $output_field_errors[] = $result->get_error_message('captcha_error');
99 }
100
101
102 return $output_field_errors;
103 }
104
105 add_filter('wppb_output_field_errors_filter', 'wppb_captcha_register_form_check_value');
106 }
107
108
109 /*
110 * Function that ads the Captcha HTML to PB custom recover password form
111 *
112 */
113 if ( function_exists('cptch_display_captcha_custom') ) {
114
115 function wppb_captcha_add_form_recover_password($output, $username_email = '') {
116
117 $cptch_options = get_option('cptch_options');
118
119 if (!empty( $cptch_options['cptch_lost_password_form'] ) && 1 == $cptch_options['cptch_lost_password_form']) {
120 $output = str_replace('</ul>', '<li>' . cptch_display_captcha_custom() . '</li>' . '</ul>', $output);
121 }
122 elseif( !empty( $cptch_options['forms']['wp_lost_password']['enable'] ) && $cptch_options['forms']['wp_lost_password']['enable'] ){
123 $output = str_replace('</ul>', '<li>' . cptch_display_captcha_custom() . '</li>' . '</ul>', $output);
124 }
125
126
127 return $output;
128 }
129
130 add_filter('wppb_recover_password_generate_password_input', 'wppb_captcha_add_form_recover_password', 10, 2);
131 }
132
133 /*
134 * Function that changes the messageNo from the Recover Password form
135 *
136 */
137 if( function_exists('cptch_register_check') ) {
138
139 function wppb_captcha_recover_password_message_no($messageNo) {
140
141 $cptch_options = get_option('cptch_options');
142
143 if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'recover_password' && ( ( !empty( $cptch_options['cptch_lost_password_form'] ) && 1 == $cptch_options['cptch_lost_password_form'] ) || ( !empty( $cptch_options['forms']['wp_lost_password']['enable'] ) && $cptch_options['forms']['wp_lost_password']['enable'] ) ) ) {
144
145 $result = cptch_register_check(new WP_Error());
146
147 if ($result->get_error_message('captcha_error') || $result->get_error_message('captcha_error'))
148 $messageNo = '';
149
150 }
151
152 return $messageNo;
153 }
154
155 add_filter('wppb_recover_password_message_no', 'wppb_captcha_recover_password_message_no');
156 }
157
158 /*
159 * Function that adds the captcha error message on Recover Password form
160 *
161 */
162 if( function_exists('cptch_register_check') ) {
163
164 function wppb_captcha_recover_password_displayed_message1($message) {
165
166 $cptch_options = get_option('cptch_options');
167
168 if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'recover_password' && ( ( !empty( $cptch_options['cptch_lost_password_form'] ) && 1 == $cptch_options['cptch_lost_password_form'] ) || ( !empty( $cptch_options['forms']['wp_lost_password']['enable'] ) && $cptch_options['forms']['wp_lost_password']['enable'] ) ) ) {
169
170 $result = cptch_register_check(new WP_Error());
171 $error_message = '';
172
173 if ($result->get_error_message('captcha_error'))
174 $error_message = $result->get_error_message('captcha_error');
175
176 if( empty($error_message) )
177 return $message;
178
179 if ( ($message == '<p class="wppb-warning">wppb_captcha_error</p>') || ($message == '<p class="wppb-warning">wppb_recaptcha_error</p>') )
180 $message = '<p class="wppb-warning">' . $error_message . '</p>';
181 else
182 $message = $message . '<p class="wppb-warning">' . $error_message . '</p>';
183
184 }
185
186 return $message;
187 }
188
189 add_filter('wppb_recover_password_displayed_message1', 'wppb_captcha_recover_password_displayed_message1');
190 }
191
192
193 /*
194 * Function that changes the default success message to wppb_captcha_error if the captcha
195 * doesn't validate so that we can change the message displayed with the
196 * wppb_recover_password_displayed_message1 filter
197 *
198 */
199 if( function_exists('cptch_register_check') ) {
200
201 function wppb_captcha_recover_password_sent_message_1($message) {
202
203 $cptch_options = get_option('cptch_options');
204
205 if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'recover_password' && ( ( !empty( $cptch_options['cptch_lost_password_form'] ) && 1 == $cptch_options['cptch_lost_password_form'] ) || ( !empty( $cptch_options['forms']['wp_lost_password']['enable'] ) && $cptch_options['forms']['wp_lost_password']['enable'] ) ) ) {
206
207 $result = cptch_register_check( new WP_Error() );
208
209 if ($result->get_error_message('captcha_error') )
210 $message = 'wppb_captcha_error';
211
212 }
213
214 return $message;
215 }
216
217 add_filter('wppb_recover_password_sent_message1', 'wppb_captcha_recover_password_sent_message_1');
218 }
219
220
221
222 /****************************************************
223 * Plugin Name: Easy Digital Downloads
224 * Plugin URI: https://wordpress.org/plugins/easy-digital-downloads/
225 ****************************************************/
226
227 /* Function that checks if a user is approved before loggin in, when admin approval is on */
228 function wppb_check_edd_login_form( $auth_cookie, $expire, $expiration, $user_id, $scheme ) {
229 $wppb_generalSettings = get_option('wppb_general_settings', 'not_found');
230
231 if( $wppb_generalSettings != 'not_found' ) {
232 if( ! empty( $wppb_generalSettings['adminApproval'] ) && ( $wppb_generalSettings['adminApproval'] == 'yes' ) ) {
233 if( isset( $_REQUEST['edd_login_nonce'] ) ) {
234 if( wp_get_object_terms( $user_id, 'user_status' ) ) {
235 if( isset( $_REQUEST['edd_redirect'] ) ) {
236 wp_redirect( esc_url_raw( $_REQUEST['edd_redirect'] ) );
237 edd_set_error( 'user_unapproved', __('Your account has to be confirmed by an administrator before you can log in.', 'profile-builder') );
238 edd_get_errors();
239 edd_die();
240 }
241 }
242 }
243 }
244 }
245 }
246 add_action( 'set_auth_cookie', 'wppb_check_edd_login_form', 10, 5 );
247 add_action( 'set_logged_in_cookie', 'wppb_check_edd_login_form', 10, 5 );
248
249
250 /****************************************************
251 * Plugin Name: Page Builder by SiteOrigin && Yoast SEO
252 * Plugin URI: https://wordpress.org/plugins/siteorigin-panels/ && https://wordpress.org/plugins/wordpress-seo/
253 * When both plugins are activated SEO generates description tags that execute shortcodes because of the filter on "the_content" added by Page Builder when generating the excerpt
254 ****************************************************/
255 if( function_exists( 'siteorigin_panels_filter_content' ) ){
256 add_action( 'wpseo_head', 'wppb_remove_siteorigin_panels_content_filter', 8 );
257 function wppb_remove_siteorigin_panels_content_filter()
258 {
259 global $post;
260 if( !empty( $post->post_content ) ) {
261 if (has_shortcode($post->post_content, 'wppb-register') || has_shortcode($post->post_content, 'wppb-edit-profile') || has_shortcode($post->post_content, 'wppb-login') || has_shortcode($post->post_content, 'wppb-list-users'))
262 remove_filter('the_content', 'siteorigin_panels_filter_content');
263 }
264 }
265
266 add_filter( 'wpseo_head', 'wppb_add_back_siteorigin_panels_content_filter', 50 );
267 function wppb_add_back_siteorigin_panels_content_filter()
268 {
269 global $post;
270 if( !empty( $post->post_content ) ) {
271 if (has_shortcode($post->post_content, 'wppb-register') || has_shortcode($post->post_content, 'wppb-edit-profile') || has_shortcode($post->post_content, 'wppb-login') || has_shortcode($post->post_content, 'wppb-list-users'))
272 add_filter('the_content', 'siteorigin_panels_filter_content');
273 }
274 }
275 }
276
277 /****************************************************
278 * Plugin Name: WPML
279 * Compatibility with wp_login_form() that wasn't getting the language code in the site url
280 ****************************************************/
281 add_filter( 'site_url', 'wppb_wpml_login_form_compatibility', 10, 4 );
282 function wppb_wpml_login_form_compatibility( $url, $path, $scheme, $blog_id ){
283 global $wppb_login_shortcode;
284 if( defined( 'ICL_LANGUAGE_CODE' ) && $wppb_login_shortcode ){
285 if( $path == 'wp-login.php' ) {
286 if( !empty( $_GET['lang'] ) )
287 return add_query_arg('lang', ICL_LANGUAGE_CODE, $url);
288 else{
289 if( function_exists('curl_version') ) {
290 /* let's see if the directory structure exists for wp-login.php */
291 $headers = wp_remote_head( trailingslashit( get_home_url() ) . $path, array( 'timeout' => 2 ) );
292 if (!is_wp_error($headers)) {
293 if ($headers['response']['code'] == 200) {
294 return trailingslashit( get_home_url() ) . $path;
295 }
296 }
297 }
298 return add_query_arg('lang', ICL_LANGUAGE_CODE, $url);
299 }
300 }
301 }
302 return $url;
303 }
304
305 /****************************************************
306 * Plugin Name: ACF
307 * Compatibility with Role Editor where ACF includes it's own select 2 and a bit differently then the standard hooks
308 ****************************************************/
309 add_action( 'admin_enqueue_scripts', 'wppb_acf_and_user_role_select_2_compatibility' );
310 function wppb_acf_and_user_role_select_2_compatibility(){
311 $post_type = get_post_type();
312 if( !empty( $post_type ) && $post_type == 'wppb-roles-editor' )
313 remove_all_actions('acf/input/admin_enqueue_scripts');
314 }
315