Skip to content

Commit

Permalink
Empty user list when "Hide inactive" option is checked
Browse files Browse the repository at this point in the history
The refactoring of db_helper_compare_days() function in commit
0a33bdf introduced usage of a new query
parameter; the parameters list is not built in the order expected by the
generated SQL query, causing the boolean value for "enabled" to be used
as a date, and the given timestamp is compared with "enabled" flag.

The SQL now applies the "disabled condition" where clause before the
date filter, so the order of parameters matches.

Also removed useless db_now() parameter assignment at line 249, the
target date parameter has already been added at line 219.

Fixes #19797
  • Loading branch information
dregad committed Jun 2, 2015
1 parent e9b9b5e commit 85f9420
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions manage_user_page.php
Expand Up @@ -214,8 +214,8 @@
$t_query = 'SELECT count(*) as user_count FROM {user} WHERE ' . $t_where . $t_show_disabled_cond;
} else {
$t_query = 'SELECT count(*) as user_count FROM {user}
WHERE ' . $t_where . ' AND ' . db_helper_compare_time( db_param(), '<', 'last_visit', $t_days_old )
. $t_show_disabled_cond;
WHERE ' . $t_where . $t_show_disabled_cond . '
AND ' . db_helper_compare_time( db_param(), '<', 'last_visit', $t_days_old );
$t_where_params[] = db_now();
}

Expand Down Expand Up @@ -244,9 +244,9 @@
$t_result = db_query( $t_query, $t_where_params, $p_per_page, $t_offset );
} else {
$t_query = 'SELECT * FROM {user}
WHERE ' . $t_where . ' AND ' . db_helper_compare_time( db_param(), '<', 'last_visit', $t_days_old ) . '
' . $t_show_disabled_cond . ' ORDER BY ' . $c_sort . ' ' . $c_dir;
$t_where_params[] = db_now();
WHERE ' . $t_where . $t_show_disabled_cond . '
AND ' . db_helper_compare_time( db_param(), '<', 'last_visit', $t_days_old ) . '
ORDER BY ' . $c_sort . ' ' . $c_dir;
$t_result = db_query( $t_query, $t_where_params, $p_per_page, $t_offset );
}

Expand Down

0 comments on commit 85f9420

Please sign in to comment.