Display user who has permission

Walky

Member
Hi !

I would to display all users who have a permission But didn't get it :(

Route class code :
PHP:
<?php

class Test_Route_PrefixAdmin_Test implements XenForo_Route_Interface
{
       public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
       {
                 return $router->getRouteMatch('Test_ControllerAdmin_Test', $routePath);
       }
}

ControllerAdmin
PHP:
<?php

class Test_ControllerAdmin_Test extends XenForo_ControllerAdmin_Abstract
{
       public function actionIndex()
       {
               $visitor = XenForo_Visitor::getInstance();
               $usersCanViewPop = $visitor->hasPermission('general', 'canViewPop');

               $viewParams = array('usersCanViewPop' => $usersCanViewPop);
               return $this->responseView('Test_ViewAdmin_Test', 'test_permissions', $viewParams);
        }
}

Template test_permissions

HTML:
{$usersCanViewPop}

Didn't display users who have the permissions (canViewPop)

Thanks
 
Last edited:
How can i query the user model ?
I believe this code is what you would do. I used this a while back to display all users who are a part of a certain usergroup. At any rate, here you are :)

PHP:
            $criteria = array(
                'secondary_group_ids' => $AvailableGroups
            );
            $options = array(
                'join' => XenForo_Model_User::FETCH_USER_FULL,
                'order' => 'username'
            );
            $finalUsers = $this->getModelFromCache('XenForo_Model_User')->getUsers($criteria, $options);

The $criteria and $options variables are just what I used, and obviously, the $criteria array is what you want to filter for. Mind you, if you're looking for a specific permission given to users individually, then it will change in your case.
 
I believe this code is what you would do. I used this a while back to display all users who are a part of a certain usergroup. At any rate, here you are :)

PHP:
            $criteria = array(
                'secondary_group_ids' => $AvailableGroups
            );
            $options = array(
                'join' => XenForo_Model_User::FETCH_USER_FULL,
                'order' => 'username'
            );
            $finalUsers = $this->getModelFromCache('XenForo_Model_User')->getUsers($criteria, $options);

The $criteria and $options variables are just what I used, and obviously, the $criteria array is what you want to filter for. Mind you, if you're looking for a specific permission given to users individually, then it will change in your case.
Thanks you !
But yes I'm looking for a specific permissions given to users individually :)
 
Back
Top Bottom