MyBB Community Forums

Full Version: admin modules dubble $sub_tabs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I look in to mybb admin cp modules file and I thing that i no need to dubble add $sub_tabs

eg on calendar.php

if($mybb->input['action'] == "add" || $mybb->input['action'] == "permissions" || !$mybb->input['action'])
{
	$sub_tabs['manage_calendars'] = array(
		'title' => $lang->manage_calendars,
		'link' => "index.php?module=config-calendars",
		'description' => $lang->manage_calendars_desc
	);
	$sub_tabs['add_calendar'] = array(
		'title' => $lang->add_calendar,
		'link' => "index.php?module=config-calendars&action=add",
	);
}

and in next if

if($mybb->input['action'] == "add")

we have tooo


$sub_tabs['add_calendar'] = array(
		'title' => $lang->add_calendar,
		'link' => "index.php?module=config-calendars&action=add",
		'description' => $lang->add_calendar_desc
	);

for what? that is unnecessary
Not sure why, the description index could be simply moved to the earlier array and the latter removed. Also, || $mybb->input['action'] == "permissions" conditional is redudant too, because the permissions page doesn't display tabs.
perms if dont have. $page -> output_nav_tabs()

we can move desc to first if like that

if($mybb->input['action'] == "add" || $mybb->input['action'] == "permissions" || !$mybb->input['action'])
{
    $sub_tabs['manage_calendars'] = array(
        'title' => $lang->manage_calendars,
        'link' => "index.php?module=config-calendars",
        'description' => $lang->manage_calendars_desc
    );
    $sub_tabs['add_calendar'] = array(
        'title' => $lang->add_calendar,
        'link' => "index.php?module=config-calendars&action=add",
        'description' => $lang->add_calendar_desc
    );
} 
and remove sub tab from add if