fixes #1162 filter users on a specific group

This commit is contained in:
plegall
2020-02-18 10:50:36 +01:00
parent d365e2d216
commit e21ef06e3d
6 changed files with 50 additions and 6 deletions
+33 -3
View File
@@ -16,6 +16,8 @@ check_status(ACCESS_ADMINISTRATOR);
check_input_parameter('iDisplayStart', $_REQUEST, false, PATTERN_ID);
check_input_parameter('iDisplayLength', $_REQUEST, false, PATTERN_ID);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Easy set variables
*/
@@ -91,11 +93,39 @@ if ( isset( $_REQUEST['iSortCol_0'] ) )
$sWhere = "";
if ( $_REQUEST['sSearch'] != "" )
{
$sWhere = "WHERE (";
for ( $i=0 ; $i<count($aColumns) ; $i++ )
$user_ids = null;
if (preg_match('/group:(\d+)/', $_REQUEST['sSearch'], $matches))
{
$sWhere .= $aColumns[$i]." LIKE '%".pwg_db_real_escape_string( $_REQUEST['sSearch'] )."%' OR ";
$group_id = $matches[1];
$query = '
SELECT
`user_id`
FROM '.USER_GROUP_TABLE.'
WHERE `group_id` = '.$group_id.'
';
$user_ids = query2array($query, null, 'user_id');
$user_ids[] = -1;
$_REQUEST['sSearch'] = preg_replace('/group:(\d+)/', '', $_REQUEST['sSearch']);
}
$sWhere = "WHERE (";
if (is_array($user_ids))
{
$sWhere.= '`user_id` IN ('.implode(',', $user_ids).') OR ';
}
if ($_REQUEST['sSearch'] != "")
{
for ( $i=0 ; $i<count($aColumns) ; $i++ )
{
$sWhere .= $aColumns[$i]." LIKE '%".pwg_db_real_escape_string( $_REQUEST['sSearch'] )."%' OR ";
}
}
$sWhere = substr_replace( $sWhere, "", -3 );
$sWhere .= ')';
}