[buddypress-trac] [BuddyPress Trac] #6007: Potential improvement to bp-members-classes.php and add_backcompat()

buddypress-trac noreply at wordpress.org
Thu Nov 13 13:38:51 UTC 2014


#6007: Potential improvement to bp-members-classes.php and add_backcompat()
--------------------------+-----------------------------
 Reporter:  Judder        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Core          |    Version:  2.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 We noticed that error messages generated by the Wordpress core, for
 example when usernames already exist, weren't being displayed but instead
 a generic message was being shown.

 It appears that bp-members-classes.php -> add_backcompat() is not re-using
 the $errors sent from wp_insert_user() but is instead creating it's own
 $errors object.
 {{{
                 if ( is_wp_error( $user_id ) || empty( $user_id ) ) {
                         $errors->add( 'registerfail', sprintf( __(
 '<strong>ERROR</strong>: Couldn’t register you. Please contact the
 <a href="mailto:%s">webmaster</a>.', 'buddypress' ), bp_get_option(
 'admin_email' ) ) );
                         return $errors;
                 }
 }}}
 We have changed our version to re-use the $user_id object instead, which,
 in the case where wp_insert_user() fails, contains the Wordpress error
 object

 Could we suggest that this is added (or similar) going forwards as it is
 handy to have the correct error messages from Wordpress core returned?

 Our minor change is:
 {{{
                 if ( is_wp_error( $user_id ) || empty( $user_id ) ) {
             $errors = $user_id;
                         //$errors->add( 'registerfail', sprintf( __(
 '<strong>ERROR</strong>: Couldn’t register you. Please contact the
 <a href="mailto:%s">webmaster</a>.', 'buddypress' ), bp_get_option(
 'admin_email' ) ) );
                         return $errors;
                 }
 }}}
 Thanks

 [Buddy Press 2.1.1]

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6007>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list