You are here

function shortcut_per_role_shortcut_default_set in Shortcut per Role 7

Implements hook_shortcut_default_set()

File

./shortcut_per_role.module, line 49
Allows users to manage customizable lists of shortcut links.

Code

function shortcut_per_role_shortcut_default_set($account) {

  //determine the highest rid of user & assign the shortcut set...
  $query = db_select('role', 'r')
    ->condition('rid', array_keys($account->roles), 'IN')
    ->fields('r', array(
    'rid',
  ))
    ->orderBy('weight', 'DESC');
  $h_rid = $query
    ->execute()
    ->fetchField();
  $ss_per_role = variable_get('shortcut_per_role', array());
  $ss = array_key_exists($h_rid, $ss_per_role) ? $ss_per_role[$h_rid] : 'shortcut_set_1';
  return $ss;
}