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 have this hook created to retrieve user password when he register or update his pass. I dont want my client to touch wordpress core so i was planning to use a hook in wp-includes/user.php All this come from this other post as i cant find any other better solution

MY problem is that the hook is being called but variables are empty.

function encrypt_password_function($pass, $id){
    global $wpdb;
    $wpdb->query($wpdb->prepare("UPDATE wp_users SET iphone_pass = %s WHERE ID = %d",array($encrypted, '10')));

function encrypt_password() {
add_action('encrypt_password', 'encrypt_password_function', 1); 
share|improve this question
How and where are you calling these functions? encrypt_password() without any arguments and with hook inside doesn't make sense. – Rarst Sep 14 '11 at 15:38
Im calling in wp-includes/user.php inside wp_insert_user function like these: encrypt_password($plain_password, $user_id); I get the plain password var before password get hashed. – chifliiiii Sep 14 '11 at 21:22
ok now i realized i was doing wrong the add_action. But now the pass is hashed and nto plain like it says on the function description :( – chifliiiii Sep 14 '11 at 21:59
Are you modifying core file to run this? Just don't. I won't even go there. :) – Rarst Sep 14 '11 at 22:00
I cant find any other way to get plain password when user register or update his password :( – chifliiiii Sep 14 '11 at 22:02
up vote 1 down vote accepted

Ok i can pass variables to hook but i was doing it wrong. Code should be:

function encrypt_password_function($pass, $id){
    global $wpdb;
    $wpdb->query($wpdb->prepare("UPDATE wp_users SET iphone_pass = %s WHERE ID = %d",array($encrypted, '10')));

function encrypt_password($var1, $var2) {
    do_action('encrypt_password',$var1, $var2);
add_action('encrypt_password', 'encrypt_password_function', 1,2); 
share|improve this answer

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.