Drupal development, web and mobile development, UIUX designing

Programmatically login a user in Drupal 7

Below gives the to programmatically login a user in Drupal 7

//Auto login new user $account = user_load($uid);// $uid is the user id $user_account = array('uid' => $account->uid); user_login_submit(array(), $user_account); Use the following code for programmatically logging in a user in drupal 8. $user = \Drupal\user\Entity\User::load($uid); // $uid is the user id user_login_finalize($user);
Programmatically login a user in Drupal development. Sreyas It Solutions is top software development firm provide support all over US Uk Spain Italy Canada






Leave a Reply

Your email address will not be published. Required fields are marked *

To Know Us Better

Browse through our work.

Explore The Technology Used

Learn about the cutting-edge technology and techniques we use to create innovative software solutions.