Opened 15 years ago
Closed 15 years ago
#2772 closed enhancement (fixed)
Error message for attempted login when user is not yet activated
| Reported by: |
|
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)
Note: See
TracTickets for help on using
tickets.
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