Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How do i get a list of categories in Plugin?
sahotataran
✭✭✭
I want to add Select Category to Feed Discussions where i can Add Feed URl to go to specific category rather than going to ROOT category.
Anybody can help me with that?
Anybody can help me with that?
There was an error rendering this rich post.
Tagged:
0
Best Answer
-
Todd Vanilla StaffI recommend turning on the debugger plugin and checking out all of the stuff in the Controller Data section. You can access that stuff from
$Sender->Data()
in most event handlers.0
Answers
$Sender->Data()
in most event handlers.$cateModel = new CategoryModel();
$cateModel -> GetAll();
print_r($cateModel); // to print the array i get from CategoryModel
But how to get only specific values eg CategoryID, CategoryName etc from the array that comes out to be
CategoryModel Object ( [Data] => [Database] => Gdn_DatabaseDebug Object ( [_ExecutionTime:protected] => 0.0073261260986328 [_Queries:protected] => Array ( [0] => Array ( [Sql] => select u.* from GDN_User u where u.UserID = :uUserID [Parameters] => Array ( [:uUserID] => 1 ) [Method] => UserModel->GetSession('1') ) [1] => Array ( [Sql] => set names 'utf8' [Parameters] => [Method] => UserModel->GetSession('1') ) [2] => Array ( [Sql] => select DISTINCT(fl.ForeignID) as `NumFlaggedItems` from GDN_Flag fl group by ForeignURL [Parameters] => Array ( ) [Method] => call_user_func(array('0' => ?OBJECT?, '1' => 'Controller_Index'), ?OBJECT?) ) [3] => Array ( [Sql] => select c.ParentCategoryID as `ParentCategoryID`, c.CategoryID as `CategoryID`, c.TreeLeft as `TreeLeft`, c.TreeRight as `TreeRight`, c.Depth as `Depth`, c.Name as `Name`, c.Description as `Description`, c.CountDiscussions as `CountDiscussions`, c.CountComments as `CountComments`, c.AllowDiscussions as `AllowDiscussions`, c.UrlCode as `UrlCode`, c.PermissionCategoryID as `PermissionCategoryID` from GDN_Category c order by TreeLeft asc [Parameters] => Array ( ) [Method] => CategoryModel->GetAll() ) ) [_QueryTimes:protected] => Array ( [0] => 0.0001680850982666 [1] => 0.0044810771942139 [2] => 0.0019569396972656 [3] => 0.00072002410888672 ) [ClassName] => Gdn_DatabaseDebug [_CurrentResultSet:Gdn_Database:private] => Gdn_DataSet Object ( [Connection] => PDO Object ( ) [_Cursor:Gdn_DataSet:private] => -1 [_DatasetType:protected] => object [_EOF:protected] => [_PDOStatement:Gdn_DataSet:private] => [_Result:protected] => Array ( [0] => stdClass Object ( [ParentCategoryID] => 0 [CategoryID] => -1 [TreeLeft] => 1 [TreeRight] => 14 [Depth] => 0 [Name] => Root [Description] => Root of category tree. Users should never see this. [CountDiscussions] => 0 [CountComments] => 0 [CategoryID] => 3 [TreeLeft] => 8 [TreeRight] => 9 [Depth] => 1 [Name] => feed [Description] => Default Rss feeds imported in Feed Discussion without any category defined go to this feed [CountDiscussions] => 1 [CountComments] => 0 [AllowDiscussions] => 1 [UrlCode] => feed [PermissionCategoryID] => -1 [CountAllDiscussions] => 1 [CountAllComments] => 0 ) [5] => stdClass Object ( [ParentCategoryID] => -1 [CategoryID] => 2 [TreeLeft] => 10 [TreeRight] => 11 [Depth] => 1 [Name] => demo [Description] => demo category 1 [CountDiscussions] => 0 [CountComments] => 13 [AllowDiscussions] => 1 [UrlCode] => demo
this is just a part of it
THis is just a part of it
There was an error rendering this rich post.