After the upgrade to TP v1.0 Beta 4 the "Download" button does not appear anymore. What could be the problem?
In index.template.php of my template (Black14K by Crip) i have this code:
// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;
// 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('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'forum', 'tpadmin')))
$current_action = $context['current_action'];
if ($context['current_action'] == 'globalAnnouncementsAdmin')
$current_action = 'admin';
if ($context['current_action'] == 'search2')
$current_action = 'search';
if (isset($_GET['dl']))
$current_action = 'dlmanager';
if (isset($_GET['board']) || isset($_GET['topic']))
$current_action = 'forum';
if ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';
// Are we using right-to-left orientation?
if ($context['right_to_left'])
{
$first = 'last';
$last = 'first';
}
else
{
$first = 'first';
$last = 'last';
}
// Show the start of the tab section.
echo '
<table cellpadding="0" cellspacing="0" border="0" style="margin-left: 0px;">
<tr><td class="post-buttons">';
if($context['TPortal']['leftbar'])
echo '<a href="javascript:void(0);" onclick="shrinkHeaderLeftbar(!current_leftbar); return false;"><img id="upshrinkLeftbar" src="', $settings['images_url'], '/', empty($options['collapse_leftbar']) ? 'upshrink.gif' : 'upshrink2.gif', '" alt="*" title="', $txt['upshrink_description'], '" style="margin: 0px 0;" border="0" /></a><img id="upshrinkTempLeftbar" src="', $settings['images_url'], '/blank.gif" alt="" style="margin-right: 0ex;" />';
// Show the [home] button.
echo ' <a href="', $scripturl, '">' , $txt[103] , '</a> ';
if($settings['TPortal_front_type']!='boardindex')
// Show the [forum] button.
echo '<a href="', $scripturl, '?action=forum">'.$txt['tp-forum'].'</a> ';
// Show the [download] button.
echo '<a href="', $scripturl, '?action=tpmod;dl">'.$txt['tp-download'].'</a> ';
// How about the [search] button?
if ($context['allow_search'])
echo '<a href="', $scripturl, '?action=search">' , $txt[182] , '</a> ';
// Show the [help] button.
echo '<a href="', $scripturl, '?action=help">' , $txt[119] , '</a> ';
// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo '<a href="', $scripturl, '?action=admin">' , $txt[2] , '</a> ';
// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '<a href="', $scripturl, '?action=profile">' , $txt[79] , '</a> ';
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo '<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a> ';
// The [calendar]!
if ($context['allow_calendar'])
echo '<a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a> ';
// the [member] list button
if ($context['allow_memberlist'])
echo '<a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a> ';
// If the user is a guest, show [login] button.
if ($context['user']['is_guest'])
echo '<a href="', $scripturl, '?action=login">' , $txt[34] , '</a> ';
// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo '<a href="', $scripturl, '?action=register">' , $txt[97] , '</a> ';
// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo '<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a> ';
if($context['TPortal']['rightbar'])
echo '<a href="javascript:void(0);" onclick="shrinkHeaderRightbar(!current_rightbar); return false;"><img id="upshrinkRightbar" src="', $settings['images_url'], '/', empty($options['collapse_rightbar']) ? 'upshrink.gif' : 'upshrink2.gif', '" alt="*" title="', $txt['upshrink_description'], '" style="margin: 0px 0;" border="0" /></a><img id="upshrinkTempRightbar" src="', $settings['images_url'], '/blank.gif" alt="" style="margin-right: 0ex;" />';
echo '</tr></td></table>';
}
It appears only if i go to Download section! Why?
Probably because '.$txt['tp-download'].' does not exist unless you are in the download section. Change that part to just say downloads and see if it does.
echo '<a href="', $scripturl, '?action=tpmod;dl">Download</a> ';
It worked ;)
But what's happened? It worked with old versione, why after upgrade it stops to work?
Because has moved the downloads manager to be a module. Which means he has moved code out of some files and into other files. So that piece of code is just not loaded on other pages anymore.
Ok, thank you ;)