function _bakery_save_slave_uid in Bakery Single Sign-On System 7.2
Same name and namespace in other branches
- 6.2 bakery.module \_bakery_save_slave_uid()
- 7.4 bakery.module \_bakery_save_slave_uid()
Save UID provided by a slave site. Should only be used on the master site.
Parameters
object $account: A local user object.
string $slave: The URL of the slave site.
integer $slave_uid: The corresponding UID on the slave site.
1 call to _bakery_save_slave_uid()
- bakery_eat_gingerbread_cookie in ./
bakery.module - Respond with account information.
File
- ./
bakery.module, line 1954 - Module file for the Bakery.
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);
}
}