Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

add_action('password_reset',array(&$this,'my_reset_password'),10,2);

and define the function as:

function my_reset_password($user, $new_password)
{

    $data=array('slave_name'=>$new_password);
    $where=array('site_user_id'=>$this->user_id);
    $res=$this->update_data(TABLE_PREFIX.'slaves',$data, $where);
    //return $res;
    //var_dump($new_pass);
    //$this->flag=$new_pass;

}

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 at 13:04
    
Why don’t you use $user->ID? –  toscho Feb 19 at 19:50

1 Answer 1

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 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 at 12:30
1  
@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 at 13:00
3  
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 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 at 12:06

Your Answer

 
discard

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.