phpBBHacks.com - Adding a New Admin Panel link
Get Photoshop help and share your work at PhotoshopForums.com
StatsForums Home   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in
FAQFAQ   SearchSearch   MemberlistMemberlist   TutorialsTutorials   ContactContact Us
Add Us:     MySpace     Facebook     StumbleUpon
Username:    Password:
Remember Me?    
Adding a New Admin Panel link
BlinkList
del.icio.us
Furl
linkaGoGo
reddit
Simpy
Mister Wong
Yahoo! My Web

Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 2: Customizing Your phpBB
 See a User Guidelines violation? Please contact us.
Author Message

Thoul
VIP

Joined: 30 Jul 2002
Posts: 17676
Location: USA

PostPosted: October 19th 2003, 1:37 pm    Post subject: Adding a New Admin Panel link Reply with quote

So, you've decided you want a new link in your Admin Panel's navigation frame. But what kind of link do you want to add? If you're looking to add a link below the "Preview Forum" link near the top, there are a couple of hacks you can use for that.

http://www.phpbbhacks.com/viewhack.php?id=758
http://www.phpbbhacks.com/viewhack.php?id=946

If you want to add a new link under a category, that's a little harder. First you need a file in the phpBB/admin/ directory. Chances are you probably already have one there to which you want the new link to point. This file is going to have to be named admin_something.php. The something can be whatever you want - there are existing files such as admin_board.php and admin_users.php. Your file, when named in this manner, will be included into the navigation frame's page to create the links you see in that frame.

In your file, there should be a line similar to this near the top. We're going to add some new code below that line.

Code:
define('IN_PHPBB', 1);


This is the new code we'll be adding. If you look at the existing admin files, you'll see code similar to this in almost all of them. Go ahead and add this to your new file. Look at your ACP's navigation frame after this change and you'll see a new category, called "Category," containing a link called "Link_Name." The URL for the link will have been set by the variable $filename in the code below.

Code:
if( !empty($setmodules) )
{
   $filename = basename(__FILE__);
   $module['Category']['Link_Name'] = $filename;

   return;
}


Now, let's customize the link. The $module line lets us do this. As you can see, this line in the above code contains the words Category and Link_Name. If Category is changed to the name of an existing category, then the link will be added under that category. Otherwise, a new category with the name you use will be shown. Changing Link_Name alters the text used for the link, as you may have guessed. Here are some examples.

Code:
// Add link called "My Styles" to existing Styles category
$module['Styles']['My_Styles'] = $filename;

// Add link called "Delete Board" to existing General category
$module['General']['Delete_Board'] = $filename;

// Add link called "Hack Settings" to a new "Hacks" category
$module['Hacks']['Hack_Settings'] = $filename;


Something interesting to note is how you can phpBB's language system to change the name of a category or link based on your selected language. If the values used for Category or Link_Name are also the name of language variables defined lang_admin.php, then those language variables will be used for the category and/or link text. For example, say you've got a language entry in your French lang_admin.php called $lang['Hack_Settings']. The contents of that entry would be the link text for the last link in the above examples.

If there is not a matching entry in the language files, then the category or link text will be exactly as you specify, except for one possible change. Any underscores will be replaced with spaces. Hack_Settings would become Hack Settings, Delete_Board would become Delete Board, and so on.

You can have multiple $module lines in a file. Take a look at this example from the phpBB 2.0.6 admin_styles.php. It adds four different links under the Styles category. Notice how some of these have query strings, such as ?mode=create. These query strings will be part of the URL in the link, allowing us to access different parts of the style management system while keeping it all in one file.

Code:
if( !empty($setmodules) )
{
   $file = basename(__FILE__);
   $module['Styles']['Add_new'] = "$file?mode=addnew";
   $module['Styles']['Create_new'] = "$file?mode=create";
   $module['Styles']['Manage'] = "$file";
   $module['Styles']['Export'] = "$file?mode=export";
   return;
}


Existing category names you can use in a $module link include Styles, Users, General, Forums and Groups. Many hacks also add new category names in their Admin Panel files.
_________________
Phantasy Star: Fringes of Algo

70+ Listings @ phpBBHacks.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 2: Customizing Your phpBB All times are GMT - 6 Hours
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Big Message Boards - Free JavaScript - phpBB2 - phpbb styles - Suporte phpBB - phpBB.it - phpBB Česky - phpBB Turkiye - phpBBArabia.com - phpBB-fr.com - Romanian phpBB online community - phpBB-TW.net - phpBBservice.nl - phpBB Brasil

Network: iFroggy Network Blog - iFroggy Hosting - SportsForums.net - KarateForums.com - YanksBlog.com - PhotoshopForums.com - DeveloperCube - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - DrGregHouse.com - Bad Boy Blog - SodaRatings.com - Patrick O'Keefe

< Advertising - Contact Us - Staff - User Guidelines >

Copyright © 2001-2009. iFroggy Network, phpBBHacks.com. All Rights Reserved. Privacy Policy. We Support phpBBHacks.com (of course!).
Powered by phpBB © phpBB Group. phpBB SEO. Hosted by 100MegsWebHosting. We are in no way affiliated with the phpBB Group. phpBB is copyright to the phpBB Group.