BuddyDev

Search

Users able to Login without Activating Their Accounts

  • Participant
    Level: Initiated
    Posts: 11
    Mocha on #23879

    For some reason, people are able to log into the website without activating their account first. When doing so, their account gets bugged out:

    – They see the blue admin bar on top when they shouldn’t (I disabled it so only admins see the bar).
    – Shown as offline
    – Friendship requests do not work and get bugged out.

    Could you offer me some assistance as to why this may be happening? Sometimes they are able to log in without activating. Other times, they get “ERROR: Your account has not been activated. Check your email for the activation link.”

  • Keymaster
    (BuddyDev Team)
    Posts: 21861
    Brajesh Singh on #23882

    Hi Mocha,
    This is not a bug in BuddyPress. Most probably your theme(custom theme?) or some plugin is causing it. Solution is to disable plugins/change theme and check for the same to find the source.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 11
    Mocha on #23895

    Brajesh,

    The theme I use is not custom (https://wordpress.org/themes/editor/). However, I did switch it back to the default theme to check (Twenty Nineteen) and unfortunately, the problem still persists. I’ve tried disabling plugins as well and I could not seem to isolate the problem.

    I see in class-bp-signup.php, line 362, you set the user_status = 2 to mean that the account has not been activated.

    
    public static function add_backcompat( $user_login = '', $user_password = '', $user_email = '', $usermeta = array() ) {
    		global $wpdb;
    
    		$user_id = wp_insert_user( array(
    			'user_login'   => $user_login,
    			'user_pass'    => $user_password,
    			'display_name' => sanitize_title( $user_login ),
    			'user_email'   => $user_email
    		) );
    
    		if ( is_wp_error( $user_id ) || empty( $user_id ) ) {
    			return $user_id;
    		}
    
    		// Update the user status to '2', ie "not activated"
    		// (0 = active, 1 = spam, 2 = not active).
    		$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_status = 2 WHERE ID = %d", $user_id ) );
    
    

    As a temporary fix while I try to figure out the root of the problem, is it possible (in the offhand chance that a user is able to login without activation) to check if the user_status == 2, then redirect them to a custom page? Alternatively, in https://example.com/wp-admin/users.php?page=bp-signups, the page generates the IDs of all the accounts that are not activated yet. Is there a way for me to fetch the user IDs for those who are not activated yet? If so, could you provide me with some guidance on how I may approach this?

    I know how to redirect them to a custom page prompting them to activate their account, I am just having problems with trying to check to see if the user is “not activated”.

    Thank you so much in advance.

  • Keymaster
    (BuddyDev Team)
    Posts: 21861
    Brajesh Singh on #23901

    Hi Mocha,
    I am sorry, The class is from BuddyPress and not from us.

    Sure, It is possible to do that.

    You can use the wp_login action for that

    https://codex.wordpress.org/Plugin_API/Action_Reference/wp_login

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved