Support » Plugin: User Access Manager » hook

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author GM_Alex

    (@gm_alex)

    Add this code to your functions.php at the theme you are using

    function userIsInUamGroup($sGroup)
    {
        global $oUserAccessManager;
        $oAccessHandler = $oUserAccessManager->getAccessHandler();
        $aGroups = $oAccessHandler->getUsergroupsForObject('user', $oUserAccessManager->getCurrentUser()->ID);
    
        foreach ($aGroups as $oGroup) {
            if ($oGroup->getGroupName() === $sGroup) {
                return true;
            }
        }
    
        return false;
    }

    Now you can use the function userIsInUamGroup to check if a user is in a group. Note that will not work for admins because these user have always full access and so the have no groups, so this function will return false.

    Working like a charm !

    Thankkksssss !!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘hook’ is closed to new replies.