Adding a New Admin Panel Link
So, you've decided you want a new link in your phpBB 2 Admin Panel's navigation menu. But what kind of link do you want to add? There are two types of links in the navigation menu. The first type are those found at the top of the menu, such as "Admin Index" and "Forum Index." You can add links in this area for quick access to important pages, both inside and outside of the Admin Panel. The second type of link is located in categories, such as "Forum Admin" and "General Admin." Modifications that add new pages to the Admin Panel often add links of this type. We'll look at both types of links.
Linking to Important Pages
Adding a link to an important page is very easy. There are many modifications you can use to place links under the "Preview Forum" link. One of these is Add phpMyAdmin Link. Even though this modification was created to add a link to phpMyAdmin, you can actually use it to link to anything at all, just by changing the URL for the link.
Other similar hacks are available at other websites.
Linking to a Page in a Category
If you want to add a new link under a category, that's a little more complex. First you need a file in your forum's admin/ directory. The link, when added, will load this file in the Admin Panel's content frame. 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 automatically 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.
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 Admin Panel'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.
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.
// 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;
You can phpBB's multiple language support 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 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 be displayed as Hack Settings, Delete_Board would display as Delete Board, and so on.
You can have multiple $module lines in a file. Take a look at this example from the phpBB 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.
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.