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;

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


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



Drupal 7.x User object reference Guide

Submitted by admin on Wed, 10/05/2016 - 14:08

$user->uid                            User ID
$user->name                      User name
$user->pass                          Encrypted password
$user->mail                          User email address
$user->theme                      (?) Name of the theme shown for this user (no longer changeable in core but can be in contrib)
$user->signature                  Signature as set in the user account settings
$user->signature_format      Text format to apply to signature