You are here

function subuser_unblock_subusers in Subuser 6

Function to unblock subusers when a parent is unblocked.

Parameters

$subusers: [optional] The array of subusers, from subuser_get_subusers(), we're interested in un-blocking.

1 call to subuser_unblock_subusers()
subuser_user in ./subuser.module
Implementation of hook_user().

File

./subuser.module, line 494
Allows users of a particular role to create sub user account in another role.

Code

function subuser_unblock_subusers($subusers = NULL) {
  if ($subusers == NULL) {
    global $user;
    $subusers = subuser_get_subusers($user->uid);
  }
  foreach ($subusers as $uid) {
    $account = user_load(array(
      'uid' => (int) $uid,
    ));

    // Skip unblocking user if they are already unblocked.
    if ($account !== FALSE && $account->status == 0) {
      user_save($account, array(
        'status' => 1,
      ));
    }
  }
}