Save CSV for specific groups only

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
User avatar
aarlauskas
Veteran Member
Posts: 127
Joined: 2019-04-28 18:03
Location: Medway, UK

Save CSV for specific groups only

Post by aarlauskas » 2019-06-07 19:04

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

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Save CSV for specific groups only

Post by pbottcher » 2019-06-07 20:24

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
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
aarlauskas
Veteran Member
Posts: 127
Joined: 2019-04-28 18:03
Location: Medway, UK

Re: Save CSV for specific groups only

Post by aarlauskas » 2019-06-08 08:05

Thanks Pböttcher, you are Star!! It works ;) Can I ask how do add the second group ? Thank You!

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Save CSV for specific groups only

Post by pbottcher » 2019-06-08 08:57

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 :-)
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
aarlauskas
Veteran Member
Posts: 127
Joined: 2019-04-28 18:03
Location: Medway, UK

Re: Save CSV for specific groups only

Post by aarlauskas » 2019-06-08 12:57

Thank You!! Have a Great Weekend! ;)

Post Reply