Skip to:
Content
Pages
Categories
Search
Top
Bottom

Problem with User activation


  • Kelvin-mariano
    Participant

    @kelvin-mariano

    Hello everybody, my problem is this, I wanted to let the user as valid after it signs up without send a confirmation e-mail with a URL to activate that account:

    have any function for this my current code is so but it still appears as “pending” on the panel?

    add_filter('bp_core_signup_send_validation_email_message', 'custom_bp_change_activation_email_message');
    function custom_bp_change_activation_email_message($message) {
    	//	Get some globals
    	global $bp, $wpdb;
    
    	//	Get the slug of the activation page
    	$slug = $bp->pages->{"activate"}->slug;
    
    	//	Get username from the signup form just posted
    	$username = $bp->signup->username;
    
    	$explode_email = explode('@', $bp->signup->email);
    
    	$user_info = get_user_by( 'email', $bp->signup->email );
    
    	if($explode_email[1] == 'dominio.com.br'){
    		$user_id = wp_update_user( array( 'ID' => $user_info->data->ID, 'role' => 'subscriber' ) );
    		delete_user_meta($user_info->data->ID, 'activation_key') ;
    		$wpdb->update( 'tb_users', array( 'user_status' => 0),array('ID' => $user_info->data->ID));
    		
    		bp_core_validate_user_signup( $username, $bp->signup->email );
    
    		$message = "Hello, your registration was successful you can now use the site normally";
    	}else{
    		$message = "Hello, register was received in our system and is waiting Site administrator approval.";
    	}
    
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Problem with User activation’ is closed to new replies.
Skip to toolbar