This mod is an expansion of the one done here: https://efiction.org/forums/index.php?topic=5368.0
Adding a Button to the Forum Header Menu:
For this example, I'll be adding the new button to the beginning of the list of links using the default SMF theme. You should back up the theme folder before trying this, and practice it before applying it to your live site.
Goto your /smf/Themes/default/ directory and open index.template.php. Then search for:
// Show the [home] button.
Above that, Add:
// Show the [library] button.
echo ($current_action== 'library' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'library' ? 'active_back' : 'back' , '">
<a href=""../?action=library">" ' , $txt['library'] , '</a>
</td>' , $current_action == 'library' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
Replace the library with archive or whatever you'd like and make sure the link is pointing to your efiction install in example above. My install is one level above my SMF install. Close and save the file.
Next go to the /smf/Themes/default/languages/ directory and open up the index.english.php file. Scroll all the way to the bottom of the file and just before the ?>, add:
$txt['library'] = 'Library';
Again, replace library with whatever you used above. Go here to see an example: http://stuff.devianthearts.com/
And that's all there is to adding a new button. Keep in mind that you can place the button wherever you choose in the list.
To get your new button's tab to stay active instead of reverting to the default forum tab:
First and most importantly, remember to back up all of your files before working on them.
First, go to your /smf/Sources/ directory and open up Load.php.
Search for:
$context['current_action'] = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
And just below that, add:
$context['current_type'] = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
$context['current_list'] = isset($_REQUEST['list']) ? $_REQUEST['list'] : null;
$context['current_sid'] = isset($_REQUEST['sid']) ? $_REQUEST['sid'] : null;
$context['current_uid'] = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : null;
$context['current_page'] = isset($_REQUEST['page']) ? $_REQUEST['page'] : null;
Save and close the file.
Next go to the /smf/Themes/default/ directory and open up index.template.php
Search for:
// Work out where we currently are.
$current_action = 'home';
if (in_array($context['current_action'], array('admin', 'ban', 'boardrecount', 'cleanperms', 'detailedversion', 'dumpdb', 'featuresettings', 'featuresettings2', 'findmember', 'maintain', 'manageattachments', 'manageboards', 'managecalendar', 'managesearch', 'membergroups', 'modlog', 'news', 'optimizetables', 'packageget', 'packages', 'permissions', 'pgdownload', 'postsettings', 'regcenter', 'repairboards', 'reports', 'serversettings', 'serversettings2', 'smileys', 'viewErrorLog', 'viewmembers')))
$current_action = 'admin';
if (in_array($context['current_action'], array('links','search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))
$current_action = $context['current_action'];
if ($context['current_action'] == 'search2')
$current_action = 'search';
if ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';
Replace with:
// Work out where we currently are.
$current_action = 'home';
if (in_array($context['current_action'], array('admin', 'ban', 'boardrecount', 'cleanperms', 'detailedversion', 'dumpdb', 'featuresettings', 'featuresettings2', 'findmember', 'maintain', 'manageattachments', 'manageboards', 'managecalendar', 'managesearch', 'membergroups', 'modlog', 'news', 'optimizetables', 'packageget', 'packages', 'permissions', 'pgdownload', 'postsettings', 'regcenter', 'repairboards', 'reports', 'serversettings', 'serversettings2', 'smileys', 'viewErrorLog', 'viewmembers')))
$current_action = 'admin';
if (in_array($context['current_action'], array('links', 'search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))
$current_action = $context['current_action'];
if ($context['current_action'] == 'search2')
$current_action = 'search';
if (in_array($context['current_action'], array('library', 'news', 'favst', 'favau', 'newstory', 'newsstory', 'featured', 'add', 'manage', 'revreceived', 'editbio', 'editprefs', 'stats', 'manfavs', 'submitted', 'manual', 'skins', 'categories', 'characters', 'ratings', 'classifications', 'members', 'mailusers', 'panels', 'settings', 'blocks', 'custpages', 'admins', 'phpinfo', 'viewlog', 'authorfields', 'maintenance', 'list', 'modules', 'report', 'viewstories', 'reviewsby')))
$current_action = 'library';
if ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';
if (in_array($context['current_type'], array('featured', 'categories', 'challenges', 'ST', 'characters', 'class', 'ratings', 'series', 'titles', 'type_id', 'recent')))
$current_action = 'library';
if (in_array($context['current_list'], array ('authors', 'admins', 'members', 'largeseries', 'smallseries', 'favseries', 'reviewedseries', 'longstories', 'shortstories', 'favstories', 'reviewedstories', 'readstories', 'prolificauthors', 'favauthors', 'prolificreviewers', 'challenges')))
$current_action = 'library';
if ($context['current_sid'] > 0 && $context['current_sid'] <1000000)
$current_action = 'library';
if ($context['current_uid'] > 0 && $context['current_uid'] <1000000)
$current_action = 'library';
if (in_array($context['current_page'], array('tos', 'rules', 'help', 'maintenance')))
$current_action = 'library';
For larger archives, you may need to change <1000000) with a larger number depending on the number of stories/chapters and members that you have. That's it for the SMF part of this one, however there are a few things you may want to change in the efiction part.
Go to the admin <<>> Page Links section of efiction: From here we'll be editing some of the links to include ?action=library after them.
First up is the Home link Just click the edit button and add ?action=library to the index.php so that you now have index.php?action=library. Just repeat that with with the following links and you're done.
Home (Already Done)
News Archive
Browse
Search
Top Tens (The Tens)
Contact Us
Admin
Warning: Do not add the ?action=library to the Account Info link. For some reason, it doesn't work. You'll get an unauthorized error.
And that's the complete mod, not counting the fist part that Tammy helped me on. The best part is that only the header from the first part will have to be changed when upgrading.
