• Not really understanding why this doesn’t work..I’m trying to look for duplicate user info in a DB and if it finds it, delete “one” of the rows (I’m having an issue where two rows are created)

    function deleteDupUsers($user_login){
    
    global $wpdb;
    
    $username_rows = $wpdb->get_results( "SELECT FROM {$wpdb->users} WHERE user_login = %s", $user_login );
    
    $count=0;
    
    if (count($username_rows) > 1){
    
    	while($count < 1){
    
    		$wpdb->query("DELETE FROM {$wpdb->users} WHERE user_login = %s", $user_login );
    
    		$count++;
    	}
    
    }
    
    }

    This should do it…right?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Per the advice given on the BuddyPress forums, you really need to be figuring out why you’re ending up with duplicated entries in wp_users first.

    Thread Starter v_andreev

    (@v_andreev)

    thanks for the reply…as advised, I’ll probably just end up reloading the files…I posted this right before reloading the files was advised…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Delete Row From WP Users…Simple Code Should Work…But It Isn't’ is closed to new replies.