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.

im working on a website where the users can connect with iphone to some functions of it by using a sha1 encrypted password. In other words the plain password of wordpress encrypted in sha1.

In the past i did the silly thing of editing the core files of wordpress to get the password when the user register and save that password in sha1 on the wp_users table.

Of course my client updated wordpress and all the functions were lost. Yeah im stupid, im not sure what i was thinking that day.

There is any way to hook to the register function to get the password , encrypt it in sha1 format and storeit in the database from the functions.php file of my theme?

Any ideas?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Have a look at Pluggable Functions in /wp-includes/pluggable.php. You can safely replace the password generating/checking functions with your own.

share|improve this answer
    
I dont want to replace wordpress register method, just add a function to it. The password when user register will be saves as normally. I want to save a sha1 encrypted pass into another table cell –  chifliiiii Sep 14 '11 at 1:48
1  
@chifliiiii - i believe the only way to get the plaintext password is to replace wp_hash_password function with essentially the same function, but add your own sha1 hash and insert into a table. look in /wp-includes/user.php at wp_insert_user and wp_update_user where wp_hash_password is called. there don't appear to be any hooks that give you access to plaintext, just the hash. –  Milo Sep 14 '11 at 2:13
    
At end i modified i added my own hook in user.php and plugable.php –  chifliiiii Sep 15 '11 at 16:33
    
@chifliiiii - just to clarify, anything you want to modify in pluggable.php should go in your own plugin, not directly in pluggable.php, as that will get overwritten when you update. –  Milo Sep 16 '11 at 1:17

You can hook into wp_check_password(), which does this at end:

return apply_filters('check_password', $check, $password, $hash, $user_id);

If $check is true then $password is current valid pass for $user_id.

Note that this will only work next time specific user logins. You can't just retrieve plan text passwords for all accounts.

share|improve this answer
    
CAn you explain me a bit better how to do that?Im really new to hooks and still dont get it right –  chifliiiii Sep 14 '11 at 22:39

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.