SETTING CRITERIA FOR WHICH RECORDS WILL SHOW ON AN "ACCESS PERMISSIONS" REPORT BASED ON THE AMOUNT OF CHECKED LIST FIELD VALUES. - Apr 13th, 2016



There were a number of reports and other pages associated with my membership site that needed access restricted to
particular members. I.E. The membership committee did not have any reason to have access to the Exhibition Submission
reports, etc.

To accomplish this I created a multi value check box list field of access permissions (allowedFolders) in the user
database, and checked the appropriate permissions on a member by member basis.

All members were granted member_access and some had other permissions as well.

To aid in the assignment and reassignment process, I created a report that shows the all the checked value label in the
allowedFolders list field for all user accounts.

The problem was that the list page showed all users, and I wasn’t sure how to exclude those records with only the one
value checked.

Damon Edis form Interactive Tools came to the rescue by adding the substr_count function in the foreach loop to count
the tab spaces in the allowedFolders string. He explained: “One value equals two tab spaces so I added the ' more than
2' condition.”


<table class="text_font" width="100%" border="1" cellspacing="0">
<tr>
<td style="padding-left:10px;">Last Name</td>
<td style="padding-left:10px;">First Name</td>
<td style="padding-left:10px;" >Assignments</td>
<td style="padding-left:10px;" >Administrator</td>

</tr>


<?php foreach ($accountsRecords as $record ): ?>
<?php if(substr_count($record['allowedFolders'], "\t") > 2): ?>

<tr>
<td style="padding-left:10px;"><?php echo $record['last_name'] ?></td>
<td style="padding-left:10px;"><?php echo $record['first_name'] ?></td>
<td style="padding-left:10px;"><?php echo join(', ', $record['allowedFolders:labels']);?></td>
<td style="padding-left:10px;"><?php if ($record['isAdmin'] == 1): ?>Yes<?php else :?>No<?php endif?></td>
</tr>
<?php endif?>
<?php endforeach; ?>


</table>






The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service