News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Current_action help anyone?

Started by żεχเ๏ภ, November 04, 2011, 06:29:32 PM

Previous topic - Next topic

żεχเ๏ภ

Hi, I installed several mods, SMF groups, blogs, staff page, tags... Each of these had their on button on the navigation bar, but I merged most of them in my new button group called "Social Centre" (as sub buttons).

Unfortunately, I don't know how to change the current action so that when someone goes to SMF groups, it points to social centre... So for the moment it'll get point to the homepage..

And advice? Thanks, Jason.

Matthew K.

Look for "$current_action" in Subs.php, and how it is determined.

./Sources/Subs.php
Code (Lines 4122 -> 4137) Select
// Figure out which action we are doing so we can set the active tab.
// Default to home.
$current_action = 'home';

if (isset($context['menu_buttons'][$context['current_action']]))
$current_action = $context['current_action'];
elseif ($context['current_action'] == 'search2')
$current_action = 'search';
elseif ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';
elseif ($context['current_action'] == 'register2')
$current_action = 'register';
elseif ($context['current_action'] == 'login2' || ($user_info['is_guest'] && $context['current_action'] == 'reminder'))
$current_action = 'login';
elseif ($context['current_action'] == 'groups' && $context['allow_moderation_center'])
$current_action = 'moderate';

Basically, you add your own condition, if it's true, you set $current_action = 'button_title'; which a couple lines down, makes that button active.

żεχเ๏ภ

Quote from: Labradoodle-360 on November 04, 2011, 06:30:40 PM
Look for "$current_action" in Subs.php, and how it is determined.

I did so... What exactly do I modify?  ???


// Figure out which action we are doing so we can set the active tab.
// Default to home.
$current_action = $modSettings['sp_portal_mode'] == 3 && empty($context['standalone']) && empty($context['disable_sp']) ? 'forum' : 'home';

//Blog Button - Adk Portal Customizers
$current_action = isset($_REQUEST['blog']) ? 'blogs' : 'home';

if (isset($context['menu_buttons'][$context['current_action']]))
$current_action = $context['current_action'];
elseif ($context['current_action'] == 'search2')
$current_action = 'search';
elseif ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';
elseif(empty($context['disable_sp']) && ((isset($_GET['board']) || isset($_GET['topic']) || in_array($context['current_action'], array('unread', 'unreadreplies', 'recent', 'stats', 'who'))) && in_array($modSettings['sp_portal_mode'], array(1, 3))))
$current_action = 'forum';
elseif ($context['current_action'] == 'register2')
$current_action = 'register';
elseif ($context['current_action'] == 'login2' || ($user_info['is_guest'] && $context['current_action'] == 'reminder'))
$current_action = 'login';
elseif ($context['current_action'] == 'groups' && $context['allow_moderation_center'])
$current_action = 'moderate';

$context['menu_buttons'][$current_action]['active_button'] = true;

if (!$user_info['is_guest'] && $context['user']['unread_messages'] > 0 && isset($context['menu_buttons']['pm']))
{
$context['menu_buttons']['pm']['alttitle'] = $context['menu_buttons']['pm']['title'] . ' [' . $context['user']['unread_messages'] . ']';
$context['menu_buttons']['pm']['title'] .= ' [<strong>' . $context['user']['unread_messages'] . '</strong>]';
}
}

Matthew K.

Unfortunately, you didn't give me enough information. If you'd like to attach your Subs.php, I can try and do it for you, on a tight time schedule right now.

żεχเ๏ภ

Note: pm, mlist, sgroups, blogs all need to point to social centre. It's id is "social".

Matthew K.

Sorry for the late reply, I had to run out of the house.

Try this file - attached.

żεχเ๏ภ

Thank you very much for your help, I do understand it alot better now.

Matthew K.

Not a problem, glad I could help you out.

Advertisement: