some of functions for working with drupal user

Submitted by admin on Tue, 01/17/2017 - 18:11

here are some functions and useful instructions for working with the drupal user entity.

 

# for modifying a user for example "user roles" :

  // Remove this role from the user's list.
  $roles_list = $account->roles;
  unset($roles_list[$rid]);

  $account = user_save($account, array('roles' => $roles_list));

 

# function "user_load" returns an object that you can find it in this article