0

I have a page-template for my custom theme that enables the user to reset their password from the front-end. I'm calling wp_set_password() and everything runs but the password is not changed in the DB. When I turn on $wpdb->show_errors() I get the following:

WordPress database error: []
UPDATE `wp_users` SET `user_pass` = '$P$BohZQNR7x.6IVoyG1LGH4Wv3xeycd70' WHERE `ID` = 9

the error happens inside wp_set_password() here:

function wp_set_password( $password, $user_id ) {
        global $wpdb;
        $hash = wp_hash_password( trim( $password ) );
        $wpdb->update($wpdb->users, array('user_pass' => $hash, 'user_activatio\
n_key' => ''), array('ID' => $user_id) );                                       
        wp_cache_delete($user_id, 'users');

}

This code is wp-includes/pluggable.php...

I'm guessing that there is something really obvious that I'm not understanding. I hope someone can clue me in...

[EDIT]: after looking at this question I tried the suggestion listed there and discovered that update() is returning '1' which indicates that it successfully updated one row which is what it should be doing. But how come the DB is not being updated when I inspect it with phpmyadmin?

[EDIT 2]: I am also using RedBeanPHP together with this template to access the same database. When I comment out the code to connect to the DB, then the update effects the DB. So perhaps this is a MySQL question and not a wordpress question? When does RedBeanPHP having a DB handle to the DB stop WPDB from updating the DB?? Sorry if this is the wrong place for the question. I would in general like an idea of how to debug this type of problem.

Thanks!

  • 2
    This is simple query, and in fact if you don't see the row been updated try obvious solutions - wrong db, wrong mysql user credentials, etc... – Butuzov Oct 16 '13 at 21:08
  • Thanks for the idea Oleg. Since it is using $wpdb the DB handle that pulls all the data from the DB - select works - it's update that's the problem... – Jason Oct 17 '13 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.