Advertisement
Guest User

Untitled

a guest
Apr 15th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. $user = array();
  2. $user['status'] = 1; //for active user
  3. $user['mail'] = 'test@test.com';
  4. //profile field $user['profile_field_fname'] = 'Vikrant';
  5. $user_account = array();
  6. if($user_uid = module_name_get_uid_by_email($user['mail'])) { //It will use for update.
  7. $user_account = user_load(array(uid => $user_uid));
  8. }
  9.  
  10. //save or update user information.
  11. user_save($user_account, $user);
  12.  
  13. //Check existing record by email.
  14. function module_name_get_uid_by_email($email){
  15. $query = db_query("SELECT uid FROM {users} WHERE mail = '%s'",$email);
  16. $result = db_fetch_object($query);
  17. return $result->uid;
  18. }
  19.  
  20. UPDATE users
  21. SET name='admin',
  22. pass='$S$Drl0vgZ9yuU9uc4JyaTMHxMPriC7q/PsOUOx52fCrVQSTpI/Tu4x',
  23. status=1
  24. WHERE uid = 1;
  25.  
  26. cd <drupal root directory>
  27. php scripts/password-hash.sh 'drupal'
  28.  
  29. drush sql-cli
  30. update users set name='admin', pass='pasted_big_hash_from_above' where uid=1;
  31. quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement