Title: hook
Last modified: August 22, 2016

---

# hook

 *  Resolved [gatelli](https://wordpress.org/support/users/gatelli/)
 * (@gatelli)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/hook-1/)
 * Hi, is there a hook or something to return a test (true/false) to know if the
   current_user is in a specified UAM group ?
 * How can I do that ?
 * Many thanks
 * Gatelli
 * [https://wordpress.org/plugins/user-access-manager/](https://wordpress.org/plugins/user-access-manager/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [gm_alex](https://wordpress.org/support/users/gm_alex/)
 * (@gm_alex)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/hook-1/#post-5849846)
 * 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.
 *  Thread Starter [gatelli](https://wordpress.org/support/users/gatelli/)
 * (@gatelli)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/hook-1/#post-5849847)
 * Working like a charm !
 * Thankkksssss !!!!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘hook’ is closed to new replies.

 * ![](https://ps.w.org/user-access-manager/assets/icon.svg?rev=1563783)
 * [User Access Manager](https://wordpress.org/plugins/user-access-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/user-access-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/user-access-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/user-access-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/user-access-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/user-access-manager/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [gatelli](https://wordpress.org/support/users/gatelli/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/hook-1/#post-5849847)
 * Status: resolved