D8 - Programmatically hack(login) into Drupal 8 - Custom Login

Here you go - For who ever(developer) think to force login as administrator.

$user = \Drupal\user\Entity\User::load(1);
user_login_finalize($user);

Add the above code in *.theme file in current/default site theme.

Comments

Popular posts from this blog

PHP - How to increase size of POST value in php

D8 KernelEvents constants

D8 - Attach file programmatically to a node