Pass variable to hook. Its possible?

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;
    $encrypted=sha1($pass);
    $wpdb->query($wpdb->prepare("UPDATE wp_users SET iphone_pass = %s WHERE ID = %d",array($encrypted, '10')));
}


function encrypt_password() {
    do_action('encrypt_password');
}
add_action('encrypt_password', 'encrypt_password_function', 1); 

Related posts

Leave a Reply

1 comment

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

    function encrypt_password_function($pass, $id){
        global $wpdb;
        $encrypted=sha1($pass);
        $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);