Page 1 of 1

restrict csv download

Posted: 2017-09-20 12:59
by bescott53
hi board, i used the sample code to restrict the csv download to a group here -http://bigprof.com/appgini/help/advance ... lename_csv

I now need to amend this to certain users so i tried to modify but it does not allow anyone to download, the update i made is below, can you help me?

function AP_master_data_init(&$options, $memberInfo, &$args){

$csvusers = array("123456789", "uk", "europe");

if(in_array($memberInfo['username']==$csvusers)){
$options->AllowCSV=1;
}else{
$options->AllowCSV=0;
}

return TRUE;

Re: restrict csv download

Posted: 2017-10-05 23:11
by a.gneady
Try changing the if statement to this:

Code: Select all

 if(in_array($memberInfo['username'], $csvusers)){

Re: restrict csv download

Posted: 2017-10-06 13:30
by bescott53
perfect, it works ok, thank you!