Skip to content

Commit 9aa5872

Browse files
committed
Added category list support
1 parent f359fd8 commit 9aa5872

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

easyblog/easyblog/category.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,20 @@ public function get() {
3636
$search = $input->get('search', null, 'STRING');
3737
$posts = array();
3838

39+
40+
if (!isset($id)) {
41+
$categoriesmodel = EasyBlogHelper::getModel( 'Categories' );
42+
$categories = $categoriesmodel->getCategoryTree('ordering');
43+
$this->plugin->setResponse( $categories );
44+
return;
45+
}
46+
3947
$category->load($id);
4048

4149
// private category shouldn't allow to access.
4250
$privacy = $category->checkPrivacy();
4351

44-
if(! $privacy->allowed )
52+
if(!$category->id || ! $privacy->allowed )
4553
{
4654
$this->plugin->setResponse( $this->getErrorResponse(404, 'Category not found') );
4755
return;

0 commit comments

Comments
 (0)