setJoinUserCategory() public method

Set whether or not to join information from GDN_UserCategory in {@link CategoryModel::calculateUser()}.
public setJoinUserCategory ( boolean $joinUserCategory ) : CategoryModel
$joinUserCategory boolean The new value to set.
return CategoryModel Returns `$this` for fluent calls.
 /**
  * Build a structured tree of children for the specified category.
  *
  * @param int|string|object|array|null $category Category or code/ID to build the tree for. Null for all.
  * @param string|null $displayAs What display should the tree be configured for?
  * @param bool $recent Join in recent record info?
  * @param bool $watching Filter categories by "watching" status?
  * @return array
  */
 private function getCategoryTree($category = null, $displayAs = null, $recent = false, $watching = false)
 {
     $categoryIdentifier = null;
     if (is_string($category) || is_numeric($category)) {
         $category = CategoryModel::categories($category);
     }
     if ($category) {
         if ($displayAs === null) {
             $displayAs = val('DisplayAs', $category, 'Discussions');
         }
         $categoryIdentifier = val('CategoryID', $category, null);
     }
     switch ($displayAs) {
         case 'Flat':
             $perPage = c('Vanilla.Categories.PerPage', 30);
             $page = Gdn::request()->get('Page', Gdn::request()->get('page', null));
             list($offset, $limit) = offsetLimit($page, $perPage);
             $categoryTree = $this->CategoryModel->getTreeAsFlat($categoryIdentifier, $offset, $limit);
             $this->setData('_Limit', $perPage);
             $this->setData('_CurrentRecords', count($categoryTree));
             break;
         case 'Categories':
         case 'Discussions':
         case 'Default':
         case 'Nested':
         default:
             $categoryTree = $this->CategoryModel->setJoinUserCategory(true)->getChildTree($categoryIdentifier ?: null, ['depth' => CategoryModel::instance()->getMaxDisplayDepth() ?: 10]);
     }
     if ($recent) {
         $this->CategoryModel->joinRecent($categoryTree);
     }
     return $categoryTree;
 }
 /**
  * Get the data for this module.
  */
 protected function getData()
 {
     // Allow plugins to set different data.
     $this->fireEvent('GetData');
     if ($this->Data) {
         return;
     }
     $categoryModel = new CategoryModel();
     $Categories = $categoryModel->setJoinUserCategory(true)->getChildTree(null);
     $Categories = CategoryModel::flattenTree($Categories);
     $Categories2 = $Categories;
     // Filter out the categories we aren't watching.
     foreach ($Categories2 as $i => $Category) {
         if (!$Category['PermsDiscussionsView'] || !$Category['Following']) {
             unset($Categories[$i]);
         }
     }
     $Data = new Gdn_DataSet($Categories, DATASET_TYPE_ARRAY);
     $Data->datasetType(DATASET_TYPE_OBJECT);
     $this->Data = $Data;
 }