Changeset 11301
- Timestamp:
- 11/01/2021 05:23:30 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-users.php
r10655 r11301 30 30 add_filter( 'query_vars', array( $this, 'add_query_vars' ) ); 31 31 add_action( 'bbp_add_rewrite_rules', array( $this, 'add_rewrite_rules' ) ); 32 33 // Don't allow attempting to set an email to one that is banned-from-use on WordPress.org. 34 add_action( 'bbp_post_request', array( $this, 'check_email_safe_for_use' ), 0 ); // bbPress is at 1 32 35 33 36 // Parse user's topic and review queries. … … 294 297 add_rewrite_rule( $user_topics_replied_to_rule . $paged_rule, 'index.php?' . $user_id . '=$matches[1]&wporg_single_user_topics_replied_to=1&' . $paged_id . '=$matches[2]', $priority ); 295 298 add_rewrite_rule( $user_topics_replied_to_rule . $feed_rule, 'index.php?' . $user_id . '=$matches[1]&wporg_single_user_topics_replied_to=1&' . $feed_id . '=$matches[2]', $priority ); 299 } 300 301 /** 302 * Verify that the a new email is valid for use. 303 * 304 * @param string $action The current action. 305 */ 306 function check_email_safe_for_use( $action = '' ) { 307 $user_id = bbp_get_displayed_user_id(); 308 $user_email = bbp_get_displayed_user_field( 'user_email', 'raw' ); 309 310 if ( 311 // Only on the front-end user edit form, and make sure the request is valid. 312 'bbp-update-user' !== $action || 313 is_admin() || 314 empty( $_POST['email'] ) || 315 ! current_user_can( 'edit_user', $user_id ) || 316 ! bbp_verify_nonce_request( 'update-user_' . $user_id ) 317 ) { 318 return; 319 } 320 321 if ( 322 $user_email !== $_POST['email'] && 323 is_email( $_POST['email'] ) && 324 is_email_address_unsafe( $_POST['email'] ) 325 ) { 326 bbp_add_error( 'bbp_user_email_invalid', __( '<strong>Error</strong>: That email address cannot be used.', 'support-forums' ), array( 'form-field' => 'email' ) ); 327 328 // Override the post variable to ensure that bbPress & core doesn't use it. 329 $_POST['email'] = $_REQUEST['email'] = $user_email; 330 } 296 331 } 297 332
Note: See TracChangeset
for help on using the changeset viewer.