As part of a build/deployment script I will need to programmatically set the site admin password.

I have read this question but the output from the accepted answer does not work. I see extra columnd salt and crypt_key. I'm guessing these are use in when generating the password.

Does anybody know the function used to generate password?

Thanks in advance

2 Answers 2


Try this code by putting withing a EE template and run:

ee()->auth->update_password([MEMBER ID], '[NEW PASSWORD]');

For EE2.4:

$EE =& get_instance();
$EE->auth->update_password([MEMBER ID], '[NEW PASSWORD]');

I hope, it would work for you.

  • Will do, thanks. It only dawned on me afterwards to look at the PHP code, silly me. Thanks.
    – jim
    Sep 2, 2013 at 12:01
  • Note here: above will work for EE2.6.0+. Sep 2, 2013 at 12:03
  • Can you please try the updated code. I hope, it will work for you. Sep 2, 2013 at 12:21

If you find that you need to get at this at a lower level, you might take a look at the source code in AJW Member Import. (I was just using this as a reference for a similar need...)

In the do_import() function in ajw_import_members_model.php (line 186), you'll see this simple conversion of a plain text password to the proper hash used by EE:

$data["password"] = do_hash( $data["password"] );

The do_hash() function is just one of the CodeIgniter Security Helper functions.

It looks like this is just a standard SHA1 hash--if so, you should be able to hash the password in any language script (e.g., if your build / deploy script is Javascript/Node or Ruby, etc.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.