function _login_destination_update_rules in Login Destination 7
Save all our changed items to the database.
Parameters
array $login_destination_rule: An associative array representing a login destination item:
- enabled: (required) can contain 0 or 1, if rule is enabled then
it should be 1 else 0.
- weight: (required) can contain any integer value.
Return value
bool The ldid of the saved login destination rule, or FALSE if the login destination rule could not be saved.
1 call to _login_destination_update_rules()
- login_destination_overview_form_submit in ./
login_destination.admin.inc - Submit handler for the login destination overview form.
File
- ./
login_destination.admin.inc, line 224 - Admin page callback file for the Login Destination module.
Code
function _login_destination_update_rules($login_destination_rule) {
if (!(isset($login_destination_rule['enabled']) && isset($login_destination_rule['weight']) && isset($login_destination_rule['ldid']))) {
return FALSE;
}
if ($login_destination_rule['enabled'] != 0 && $login_destination_rule['enabled'] != 1) {
return FALSE;
}
$login_destination_rule['weight'] = (int) $login_destination_rule['weight'];
if (!is_int($login_destination_rule['weight'])) {
return FALSE;
}
db_update('login_destination')
->fields(array(
'enabled' => $login_destination_rule['enabled'],
'weight' => $login_destination_rule['weight'],
))
->condition('id', $login_destination_rule['ldid'])
->execute();
return $login_destination_rule['ldid'];
}