I added the following to the TABLENAME_init() function in the hook file for this table:
Code: Select all
// Customise views and features for public users
if ($memberInfo['group'] == 'anonymous') {
// Prevent them from using the "Save as CSV" function
$options->AllowCSV = 0;
// Select the columns they can see in the Table View
// Numbered from 1 = 'ID' to 11 = 'Notes'
$options->ColNumber = array(3, 5, 6, 7, 8);
}
If I understood the documentation for the Datalist object, the columns displayed in Table View are controlled by the ColNumber array. Indeed, TABLENAME_view.php initialises $x->ColNumber to an array of the normal columns I selected as visible in AppGini.
I know that the guest is indeed "anonymous" because I displayed the contents of $memberInfo['group'] in a debug statement. Further, the AllowCSV option in the same "if" condition of my code works perfectly.
I've also displayed the contents of $options->ColNumber in a debug statement (using print_r), and they have been changed as per my code.
Further, I added a debug statement to TABLENAME_view.php after returning from calling TABLENAME_init(), but before rendering the page. Here also $x->ColNumber has been changed by my code.
In spite of all this, all columns that were initially set in TABLENAME_view.php before calling the TABLENAME_init() function are still being displayed. One odd thing is that the last five columns have a yellow down-arrow graphic showing at the top of the column as if they had been sorted as descending, although no such sort has been applied.
Am I missing something fundamental here, or is this a bug?
Any help would be greatly appreciated. Thanks,
Garry