Improve compatibility between 'user' and 'password policy tab' modules

This commit is contained in:
Manuel Cillero 2017-08-18 00:06:44 +02:00
parent 56910ad47f
commit 7ac2bb7013
3 changed files with 15 additions and 3 deletions

View file

@ -513,7 +513,18 @@ function password_policy_cron() {
}
// Get all users' last password change time. We don't touch blocked accounts
$result = db_query("SELECT u.uid AS uid, u.created AS created_u, p.created AS created_p, e.pid AS pid, e.warning AS warning, e.unblocked AS unblocked FROM {users} u LEFT JOIN {password_policy_history} p ON u.uid = p.uid LEFT JOIN {password_policy_expiration} e ON u.uid = e.uid WHERE u.uid > 0 AND u.status = 1 ORDER BY p.created ASC");
$result = db_query('
SELECT u.uid AS uid,
u.created AS created_u,
p.created AS created_p,
e.pid AS pid,
e.warning AS warning,
e.unblocked AS unblocked
FROM {users} u
LEFT JOIN {password_policy_history} p ON u.uid = p.uid
LEFT JOIN {password_policy_expiration} e ON u.uid = e.uid
WHERE u.uid > 0 AND u.status = 1 ORDER BY p.created ASC
');
while ($row = db_fetch_object($result)) {
if ($row->uid == 1 && !variable_get('password_policy_admin', 0))
continue;

View file

@ -1145,7 +1145,8 @@ function user_menu() {
if (($categories = _user_categories($empty_account)) && (count($categories) > 1)) {
foreach ($categories as $key => $category) {
// 'account' is already handled by the MENU_DEFAULT_LOCAL_TASK.
if ($category['name'] != 'account') {
// 'password' is handled by password_policy_password_tab module if it is installed.
if ($category['name'] != 'account' && (!module_exists('password_policy_password_tab') || $category['name'] != 'password')) {
$items['user/%user_category/edit/'. $category['name']] = array(
'title callback' => 'check_plain',
'title arguments' => array($category['title']),

View file

@ -42,7 +42,7 @@ function user_pass() {
function user_pass_validate($form, &$form_state) {
$name = trim($form_state['values']['name']);
// Try to load by email.
$account = user_load(array('mail' => $name, 'status' => 1));