Page 1 of 1

Save CSV for specific groups only

Posted: 2019-06-07 19:04
by aarlauskas
Hi All, is there a way to show 'Save CSV' button to the specific groups only? In Appgini it either removes this button completely or show to all. I need this button to only be available for Admin group and maybe one another. I've seen two old posts here that suggests the way of doing, but neither of them seem to work. First suggestion not doing anything, second does the same as Apggini app, show or remove for all. I do appreciate your help! Thanks

Re: Save CSV for specific groups only

Posted: 2019-06-07 20:24
by pbottcher
Hi,

you can use the hooks/TABLENAME.php file (TABLENAME = your table) and put into the
TABLENAME_init function

the code:

Code: Select all

if ($memberInfo['group'] != 'Admins') 
{
$options->AllowCSV = 0; 
}
this would only allow the members of the Admins group to use the CSV download

Re: Save CSV for specific groups only

Posted: 2019-06-08 08:05
by aarlauskas
Thanks Pböttcher, you are Star!! It works ;) Can I ask how do add the second group ? Thank You!

Re: Save CSV for specific groups only

Posted: 2019-06-08 08:57
by pbottcher
Hi,

you can do e.g.

Code: Select all

if (!in_array($memberInfo['group'],array('Admins','Group2','Group3','etc...')
or

Code: Select all

if ($memberInfo['group'] != 'Admins' && $memberInfo['group'] != 'Group2' && $memberInfo['group'] != 'Group3'   etc... )
replace Group2, Group3 with your groups,
the etc... is symbolic for additional groups to be added :-)

Re: Save CSV for specific groups only

Posted: 2019-06-08 12:57
by aarlauskas
Thank You!! Have a Great Weekend! ;)