function ajax_register_update_7407 in Ajax Login/Register 7.4
Rename existing redirect variables and create new redirect behavior variable from redirect url.
File
- ./
ajax_register.install, line 42 - Install, update and uninstall functions for the AJAX REGISTER module.
Code
function ajax_register_update_7407() {
// Login and register redirect behaviors should initially refresh the page.
// This has always been the default functionality provided by the module.
$login_behavior = 'refresh';
$register_behavior = 'refresh';
// Set the password redirect to none, as this was the default behavior.
$password_behavior = 'none';
// Load the existing variables and then delete them.
$login_redirect_url = variable_get('ajax_register_login_form_redirect', '');
variable_del('ajax_register_login_form_redirect');
if (!empty($login_redirect_url)) {
$login_behavior = 'custom';
}
$register_redirect_url = variable_get('ajax_register_register_form_redirect', '');
variable_del('ajax_register_register_form_redirect');
if (!empty($register_redirect_url)) {
$register_behavior = 'custom';
}
elseif ($register_redirect_url == '<noredirect>') {
$register_behavior = 'none';
$register_redirect_url = '';
}
// Save the new variables.
variable_set('ajax_register_login_redirect_behavior', $login_behavior);
variable_set('ajax_register_register_redirect_behavior', $register_behavior);
variable_set('ajax_register_password_redirect_behavior', $password_behavior);
// Only set the new custom URL redirects if they're not actually empty.
if (!empty($login_redirect_url)) {
variable_set('ajax_register_login_redirect_url', $login_redirect_url);
}
if (!empty($register_redirect_url)) {
variable_set('ajax_register_register_redirect_url', $register_redirect_url);
}
}