Page 1 of 1

Filter records by user group

Posted: 2015-04-30 13:59
by Terry
I am trying to use hooks to limit the records that a user group sees by setting a filter on the table using this:
table: nbsrt_members
filter on: branch column (#17 in table)
branch values: region1/region2 or region3
I have 3 groups: region1_group / region2_group / region3_group
** I cannot select records based on their entries because these particular users cannot enter records
---------------------------------code I am trying to use to filter for region1_group--------------------------------
function nbsrt_members_init(&$options, $memberInfo, &$args){
/* Apply a default filter only if no filter is already applied by the user */
if(!$_POST['FilterField'][1] && !$_GET['FilterField'][1]){
if($memberInfo['group']=='region1_group') {
if(!$_POST['FilterField'][1] && !$_GET['FilterField'][1])
addFilter(1, 'and' , 17, 'like', 'region1');
}
}
return TRUE;
}

Result is that no filter gets activated and all of the records show for each group - doing something wrong??
Once I get one group working I will add the necessary else statements to handle the other groups.

Re: Filter records by user group

Posted: 2015-05-21 05:59
by Satya Kavala
Hi Terry,
pease check your PM i can help you.