Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/25/2012 06:21:27 PM (14 years ago)
Author:
boonebgorges
Message:

Some hardening of the member registration process:

  • Ensures that pre_user_login filters are applied before attempting to create a user with wp_insert_user(), so that BP's username validation is the same as WP's, and username_exists() checks are reliable.
  • Check to see whether the return value of wp_insert_user() is a WP_Error object before continuing with the registration process.
  • Improves error handling during user creation, by correctly parsing WP_Error objects returned from wp_insert_user().

See #3949.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-members/bp-members-functions.php

    r5837 r5840  
    949949    $user_email = sanitize_email( $user_email );
    950950
     951    // Apply any user_login filters added by BP or other plugins before validating
     952    $user_name = apply_filters( 'pre_user_login', $user_name );
     953
    951954    if ( empty( $user_name ) )
    952955        $errors->add( 'user_name', __( 'Please enter a username', 'buddypress' ) );
     
    10321035        ) );
    10331036
    1034         if ( empty( $user_id ) ) {
     1037        if ( is_wp_error( $user_id ) || empty( $user_id ) ) {
    10351038            $errors->add( 'registerfail', sprintf( __('<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'buddypress' ), bp_get_option( 'admin_email' ) ) );
    10361039            return $errors;
Note: See TracChangeset for help on using the changeset viewer.