Last active
December 17, 2015 04:39
-
-
Save joshuaadickerson/5552134 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check if a user can see a board based on the board groups | |
* A PHP equivalent to {query_see_board} | |
* | |
* @param array $board_groups | |
* @param array $board_deny_groups (optional) | |
* @return boolean | |
*/ | |
function canSeeBoard($board_groups, $board_deny_groups = array()) | |
{ | |
global $user_info, $modSettings; | |
if ($user_info['is_admin']) | |
return true; | |
// If the user is a member of any of these groups, send them packin' | |
if (!empty($modSettings['deny_boards_access']) && !empty($board_deny_groups) && array_intersect($board_deny_groups, $user_info['groups']) != array()) | |
return false; | |
// If anything matches, they are okay | |
return array_intersect($board_groups, $user_info['groups']) != array(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment