Search code examples
phpdrupal-7hook

How to get password value in Drupal 7?


I trying to get password value without a hash in hook_user_presave(), and I can do that easy when create user, I just get it in $account variable. But when I edit user, pass in $account in hash to because $account data getting from database. So how i can get plain password value?

Here is my hook:

function hook_user_presave(&$edit, $account, $category) {
    if (isset($account->pass)) {
        $edit['field_clean_pass']['und'][0]['value'] = $account->pass;
    }
}

Solution

  • How about Masquerade module?

    If admin needs to be logged in as any user this module is what you need.