You are here

function _bakery_save_slave_uid in Bakery Single Sign-On System 6.2

Same name and namespace in other branches
  1. 7.4 bakery.module \_bakery_save_slave_uid()
  2. 7.2 bakery.module \_bakery_save_slave_uid()

Save UID provided by a slave site. Should only be used on the master site.

Parameters

$account: A local user object.

$slave: The URL of the slave site.

$slave_uid: The corresponding UID on the slave site.

3 calls to _bakery_save_slave_uid()
bakery_eat_gingerbread_cookie in ./bakery.module
Respond with account information.
bakery_eat_thinmint_cookie in ./bakery.module
Update the user's login time to reflect them validating their email address.
bakery_user in ./bakery.module
Implementation of hook_user().

File

./bakery.module, line 1781

Code

function _bakery_save_slave_uid($account, $slave, $slave_uid) {
  if (variable_get('bakery_is_master', 0) && !empty($slave_uid) && in_array($slave, variable_get('bakery_slaves', array())) && !db_result(db_query_range("SELECT 1 FROM {bakery_user} WHERE uid = %d AND slave = '%s'", $account->uid, $slave, 0, 1))) {
    $row = array(
      'uid' => $account->uid,
      'slave' => $slave,
      'slave_uid' => $slave_uid,
    );
    drupal_write_record('bakery_user', $row);
  }
}