You are here

function _bakery_save_slave_uid in Bakery Single Sign-On System 7.4

Same name and namespace in other branches
  1. 6.2 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.

2 calls to _bakery_save_slave_uid()
bakery_profile_eat_gingerbread_cookie in ./bakery_profile.module
Respond with account information.
bakery_profile_eat_thinmint_cookie in ./bakery_profile.module
Update the user's login time to reflect them validating their email address.

File

./bakery.module, line 836

Code

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