You are here

function mobile_tools_user_OLD in Mobile Tools 7.2

Same name in this branch
  1. 7.2 mobile_tools_roles/mobile_tools_roles.module \mobile_tools_user_OLD()
  2. 7.2 mobile_tools_roles/mobile_tools_roles.inc \mobile_tools_user_OLD()

Implementation of the user_load function to assure that the right role is being assigned to the user. This is the same actions as in the hook_init() method

File

mobile_tools_roles/mobile_tools_roles.module, line 45
Contains the functionality to add mobile user roles

Code

function mobile_tools_user_OLD($op, &$edit, &$account, $category = NULL) {

  // TODO Remaining code in this function needs to be moved to the appropriate new hook function.
  if (variable_get('mobile_tools_enable_roles', 0)) {
    switch ($op) {
      case 'load':
        $user = $account;
        $roles = $user->roles;
        foreach ($roles as $key => $value) {
          $role = mobile_tools_roles_info(array(
            'id' => $key,
          ));
          if ($role->type == 'desktop' && $role->has_sibling == 1 && $_SESSION['mobile-tools-site-type'] == 'mobile') {
            unset($user->roles[$key]);
            $user->roles[$role->sibling['id']] = $role->sibling['name'];
          }
        }
        break;
    }
  }
}