New extension: categoryicons-1.0.3.zip
[vanilla-miry.git] / extensions / UserFilters / default.php
blobb6dfdcbe13f8eca2e2091a21108883cfa48ffd2e
1 <?php
2 /*
3 Extension Name: User Filters
4 Extension Url: http://lussumo.com/addons/
5 Description: Adds links to the Control Panel of each user's Account page that show that user's discussions and comments
6 Version: 1.0.2
7 Author: Aaron Olson
8 Author Url: http://www.houseblogs.net
10 You should cut & paste these language definitions into your
11 conf/your_language.php file (replace "your_language" with your chosen language,
12 of course):
15 $Context->Dictionary["UsersFilters"] = "Activity";
16 $Context->Dictionary["UsersDiscussions"] = "Discussions Started";
17 $Context->Dictionary["UsersComments"] = "Comments Added";
20 if ($Context->SelfUrl == "account.php" && ForceIncomingString('PostBackAction', '') == '') {
22 //Define the account that is being viewed
23 // Don't reload objects if you don't need to (ie. If another extension has already loaded it)
24 if (!@$UserManager) $UserManager = $Context->ObjectFactory->NewContextObject($Context, "UserManager");
25 $AccountUserID = ForceIncomingInt("u", $Context->Session->UserID);
26 $AccountUser = $UserManager->GetUserById($AccountUserID);
28 //Define the URLs to search for this User's content
29 $UserDiscussions_SearchString = 'PostBackAction=Search&Type=Discussions&Advanced=1&Keywords=&Categories=&AuthUsername=' . $AccountUser->Name . '&btnSubmit=Search';
30 $UserComments_SearchString = 'PostBackAction=Search&Keywords=' . $AccountUser->Name . '%3A&Type=Comments&btnSubmit=Search';
32 //Customize the Control Panel list title
33 $UserFilterTitle = $AccountUser->Name . '\'s ' . $Context->GetDefinition('UsersFilters');
36 //Add the links to the panel
37 $UsersFilters = $UserFilterTitle;
38 $DiscussionFilters = $Context->GetDefinition("UsersDiscussionFilters");
39 $Panel->AddList($UsersFilters, 0, 1);
40 $Panel->AddListItem($UsersFilters, $Context->GetDefinition("UsersDiscussions"), GetUrl($Configuration, "search.php", "", "", "", "", $UserDiscussions_SearchString), "", "", 10);
41 $Panel->AddListItem($UsersFilters, $Context->GetDefinition("UsersComments"), GetUrl($Configuration, "search.php", "", "", "", "", $UserComments_SearchString), "", "", 10);