original_string: public function UserModel_GetCategoryViewPermission_Create($Sender) {
        static $PermissionModel = NULL;
  
  
        $UserID = ArrayValue(0, $Sender->EventArguments, '');
  		$CategoryID = ArrayValue(1, $Sender->EventArguments, '');
        $Permission = GetValue(2, $Sender->EventArguments, 'Vanilla.Discussions.View');
  		if ($UserID && $CategoryID) {
           if ($PermissionModel === NULL)
              $PermissionModel = new PermissionModel();
           
           $Category = CategoryModel::Categories($CategoryID);
           if ($Category)
              $PermissionCategoryID = $Category['PermissionCategoryID'];
           else
              $PermissionCategoryID = -1;
           
           $Result = $PermissionModel->GetUserPermissions($UserID, $Permission, 'Category', 'PermissionCategoryID', 'CategoryID', $PermissionCategoryID);
           return (GetValue($Permission, GetValue(0, $Result), FALSE)) ? TRUE : FALSE;
        }
        return FALSE;
     }
code: public function UserModel_GetCategoryViewPermission_Create($Sender) {
        static $PermissionModel = NULL;
  
  
        $UserID = ArrayValue(0, $Sender->EventArguments, '');
  		$CategoryID = ArrayValue(1, $Sender->EventArguments, '');
        $Permission = GetValue(2, $Sender->EventArguments, 'Vanilla.Discussions.View');
  		if ($UserID && $CategoryID) {
           if ($PermissionModel === NULL)
              $PermissionModel = new PermissionModel();
           
           $Category = CategoryModel::Categories($CategoryID);
           if ($Category)
              $PermissionCategoryID = $Category['PermissionCategoryID'];
           else
              $PermissionCategoryID = -1;
           
           $Result = $PermissionModel->GetUserPermissions($UserID, $Permission, 'Category', 'PermissionCategoryID', 'CategoryID', $PermissionCategoryID);
           return (GetValue($Permission, GetValue(0, $Result), FALSE)) ? TRUE : FALSE;
        }
        return FALSE;
     }
code_tokens: public function UserModel_GetCategoryViewPermission_Create ( $ Sender ) { static $ PermissionModel = NULL ; $ UserID = ArrayValue ( 0 , $ Sender -> EventArguments , '' ) ; $ CategoryID = ArrayValue ( 1 , $ Sender -> EventArguments , '' ) ; $ Permission = GetValue ( 2 , $ Sender -> EventArguments , 'Vanilla.Discussions.View' ) ; if ( $ UserID && $ CategoryID ) { if ( $ PermissionModel === NULL ) $ PermissionModel = new PermissionModel ( ) ; $ Category = CategoryModel :: Categories ( $ CategoryID ) ; if ( $ Category ) $ PermissionCategoryID = $ Category [ 'PermissionCategoryID' ] ; else $ PermissionCategoryID = - 1 ; $ Result = $ PermissionModel -> GetUserPermissions ( $ UserID , $ Permission , 'Category' , 'PermissionCategoryID' , 'CategoryID' , $ PermissionCategoryID ) ; return ( GetValue ( $ Permission , GetValue ( 0 , $ Result ) , FALSE ) ) ? TRUE : FALSE ; } return FALSE ; }
docstring: Check whether a user has access to view discussions in a particular category.
  
  @since 2.0.18
  @example $UserModel->GetCategoryViewPermission($UserID, $CategoryID).
  
  @param $Sender UserModel.
  @return bool Whether user has permission.
docstring_tokens: Check whether a user has access to view discussions in a particular category .