WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am developing a plugin where a MySQL user is created with username same as WP-username and password is entered by user using form . Now If the user resets its password in WordPress then the same password should be set in MySQL user. for that purpose I tried to use password_reset hook but it is not working Code: I use this code in init


and define the function as:

function my_reset_password($user, $new_password)

    $res=$this->update_data(TABLE_PREFIX.'slaves',$data, $where);
    //return $res;


The above code runs successfully as individual but when hooked with password_reset it is not working. suggestions with code samples will be appreciated.

share|improve this question
What is your definition of "MySQL user"? So far that plan looks like adding a backdoor... – kaiser Feb 19 '14 at 13:04
Why don’t you use $user->ID? – toscho Feb 19 '14 at 19:50

I appreciate your question. This is the solution for you

RewriteCond %{QUERY_STRING} ^.*(bash|git|hg|log|svn|swp|cvs) [NC,OR]

Change the ID on the user with ID 1, Change the WordPress database table prefix Change wp-content path, Display a random version number to non administrative users anywhere version is used.

Thats it.. Isnt it so simple???

Also try this

function ppr_setup() {

/* Loads the plugin translation files. */
load_plugin_textdomain( 'prevent-password-reset', false, 'prevent-password-        reset/languages' );

/* Filters whether the user's password can be reset. */
add_filter( 'allow_password_reset', 'ppr_allow_password_reset', 10, 2 );

/* Hook into user's personal options to display checkbox. */
add_action( 'personal_options', 'ppr_personal_options' );

/* Save whether the user allows password resetting. */
add_action( 'personal_options_update', 'ppr_save_user_meta' );
add_action( 'edit_user_profile_update', 'ppr_save_user_meta' );

 /* Custom meta for plugin on the plugins admin screen. */
add_filter( 'plugin_row_meta', 'ppr_plugin_row_meta', 10, 2 );

Best Luck. @Jaykumar

share|improve this answer
Sorry Ididnt get you. Actually iam saving this info into external database. The code works fine outside. But in the hook is not working – Jaykumar Patil Feb 19 '14 at 12:21
I think you are new to wordpress. Try to google it you will definately get the solution there. GOOD LUCK – John Feb 19 '14 at 12:30
@John What's that? You're assigning a bunch of undefined (or simply not shown) callbacks, then showing a bunch of rewrite conditions? This is far from an answer - more like random code. – kaiser Feb 19 '14 at 13:00
This answer has no relation to the original question. I don;t understand why a rewrite rule condition in htaccess has anything to do with changing the passwords of MySQL DB users via PHP. If you disagree please edit your answer to explain – Tom J Nowell Feb 19 '14 at 15:35
You appear to have simply lifted the add_action hooks directly from Justin Tadlock's Prevent Password Reset plugin without having any idea what they do, or what add_action is for. For any future people who Googled this on Bing: disregard everything in the above answer. – indextwo Oct 19 '14 at 12:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.