好的,我可以将变量传递给钩子,但我做错了。代码应为:
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);