bug 1683 fixed: as soon as an admin modifies the admin>conf>options>guest settings, registration is broken. This is because user_infos.theme/language are emptied (while they should not).
I have also added an "automatic repair" piece of code in get_default_user_info function. This piece of code should be removed for 2.2 with the appropriate migration task. git-svn-id: http://piwigo.org/svn/branches/2.1@6311 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
640d9ebccc
commit
0786ff3b79
2 changed files with 43 additions and 0 deletions
|
@ -796,6 +796,47 @@ function get_default_user_info($convert_str = true)
|
||||||
unset($cache['default_user']['user_id']);
|
unset($cache['default_user']['user_id']);
|
||||||
unset($cache['default_user']['status']);
|
unset($cache['default_user']['status']);
|
||||||
unset($cache['default_user']['registration_date']);
|
unset($cache['default_user']['registration_date']);
|
||||||
|
|
||||||
|
// theme and language fields may be null in the database (see
|
||||||
|
// bug:1683) This is absolutely not nice to have this code in this
|
||||||
|
// very place, but it avoids a complexe upgrade with an "automatic
|
||||||
|
// fix" in the database => this code should be removed after branch
|
||||||
|
// 2.1 if a migration tasks performs the job the same way
|
||||||
|
if (empty($cache['default_user']['theme']))
|
||||||
|
{
|
||||||
|
mass_updates(
|
||||||
|
USER_INFOS_TABLE,
|
||||||
|
array(
|
||||||
|
'primary' => array('user_id'),
|
||||||
|
'update' => array('theme')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'user_id' => $conf['default_user_id'],
|
||||||
|
'theme' => PHPWG_DEFAULT_TEMPLATE
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$cache['default_user']['theme'] = PHPWG_DEFAULT_TEMPLATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($cache['default_user']['language']))
|
||||||
|
{
|
||||||
|
mass_updates(
|
||||||
|
USER_INFOS_TABLE,
|
||||||
|
array(
|
||||||
|
'primary' => array('user_id'),
|
||||||
|
'update' => array('language')
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'user_id' => $conf['default_user_id'],
|
||||||
|
'language' => PHPWG_DEFAULT_LANGUAGE
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$cache['default_user']['language'] = PHPWG_DEFAULT_LANGUAGE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,8 @@ function save_profile_from_post($userdata, &$errors)
|
||||||
$_POST['theme'],
|
$_POST['theme'],
|
||||||
$_POST['language']
|
$_POST['language']
|
||||||
);
|
);
|
||||||
|
$_POST['theme'] = get_default_theme();
|
||||||
|
$_POST['language'] = get_default_language();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf['allow_user_customization'] or defined('IN_ADMIN'))
|
if ($conf['allow_user_customization'] or defined('IN_ADMIN'))
|
||||||
|
|
Loading…
Add table
Reference in a new issue