How to get admin permissions for drupal user using drush

There are couple of ways to do it:

First, you can just add an appropriate permission to your user. But you have to know the ID of the administration role on your site. For example, this id is equals 3:
sudo drush sql-query "INSERT INTO users_roles (uid, rid) VALUES (29157, 3);"

The second way, you can just change the password of the main user, I have a hash for 123 password, just run this query and then you will be able to log to your site with 'admin' user and '123' password:
sudo drush sql-query "UPDATE users SET pass='$S$D.w4fp/UMSMPvuXW4ThkKL98pBPYi2SsjeGV2YmKfZrXjcfvL' WHERE uid = 1"

And the last one - you can write some php code in any drupal module in hook _init() to get admin permissions for this session, for example:

function mymodul_init() {
  global $user;
  $user = user_load(1);

Don't forget to clear drupal cache to make it work.
Then you can create a new user with an appropriate permissions.

Good luck!

Drupal 7


Stacie 25.08.2018 - 05:58

The websites that have been able to conduct

the games integrate casino security system. The best online casino gambling are located in two distinct formats: play-for-pay and free casino

sites. It teases you which has a high amount of jackpot if you

possibly could have the matching themes when playing farmville on online casino.

Also visit my web site: 온라인카지노

Добавить комментарий