Same name and namespace in other branches
  1. 8.9.x core/modules/shortcut/shortcut.module \shortcut_set_assign_user()

Assigns a user to a particular shortcut set.

Parameters

$shortcut_set: An object representing the shortcut set.

$account: A user account that will be assigned to use the set.

4 calls to shortcut_set_assign_user()
ShortcutSetsTestCase::testShortcutSetAssign in modules/shortcut/shortcut.test
Tests switching another user's shortcut set.
ShortcutSetsTestCase::testShortcutSetUnassign in modules/shortcut/shortcut.test
Tests unassigning a shortcut set.
ShortcutTestCase::setUp in modules/shortcut/shortcut.test
Sets up a Drupal site for running functional and integration tests.
shortcut_set_switch_submit in modules/shortcut/shortcut.admin.inc
Submit handler for shortcut_set_switch().

File

modules/shortcut/shortcut.module, line 441
Allows users to manage customizable lists of shortcut links.

Code

function shortcut_set_assign_user($shortcut_set, $account) {
  db_merge('shortcut_set_users')
    ->key(array(
    'uid' => $account->uid,
  ))
    ->fields(array(
    'set_name' => $shortcut_set->set_name,
  ))
    ->execute();
  drupal_static_reset('shortcut_current_displayed_set');
}