Skip to:
Content

BuddyPress.org

Opened 14 years ago

Closed 13 years ago

#2772 closed enhancement (fixed)

Error message for attempted login when user is not yet activated

Reported by: detrate's profile detrate Owned by:
Milestone: 1.5 Priority: normal
Severity: Version:
Component: Core Keywords: error messages
Cc:

Description

I was confused as a developer as to why I couldn't login as a user. I realized (thanks boonebgorges) that it's because I hadn't activated the users yet.

I know this seems obvious in hindsight but the major issue I faced in troubleshooting this, was a lack of an error message.

If I, as a developer was confused, I can only imagine what my users would think.

workaround, add the following to bp-custom.php:

remove_filter( 'authenticate', 'bp_core_signup_disable_inactive' );
add_filter( 'authenticate', 'bp_core_signup_disable_inactive_with_error', 11, 2);

function bp_core_signup_disable_inactive_with_error( $auth_obj, $username ) {
	global $bp, $wpdb;

	if ( !$user_id = bp_core_get_userid( $username ) )
		return $auth_obj;

	$user_status = (int) $wpdb->get_var( $wpdb->prepare( "SELECT user_status FROM $wpdb->users WHERE ID = %d", $user_id ) );

	if ( 2 == $user_status ) {
		bp_core_add_message( 'It looks like you have not activated your account yet.' );
		bp_core_redirect( $bp->root_domain );
	} else {
		return $auth_obj;
	}
}

function bbg_add_template_notice_to_header() {
	if ( !is_user_logged_in() )
		do_action( 'template_notices' );
}
add_action( 'bp_before_container', 'bbg_add_template_notice_to_header' );

Change History (2)

#1 @detrate
14 years ago

s/bp_core_add_message( 'It looks like you have not activated your account yet.' );/bp_core_add_message( 'It looks like you have not activated your account yet.', 'error' );/

message should have 'error' param

#2 @DJPaul
13 years ago

  • Resolution set to fixed
  • Status changed from new to closed

This was fixed in r3734

Note: See TracTickets for help on using tickets.