Development > Feature Requests

Remove forum buttons from home page

(1/3) > >>

rocknroller:
Option to remove Main menu buttons from portal home page.

example:
- You can make custom pages, related to your activities and link them. Make custom menu eg. Contacts, About us, Forum.. etc.
Sometimes you do not want to have a forum in the foreground.

have that option it would be nice.  :)

Eliana Tamerin:
You can do it by editing your Subs.php. For example:


--- Code: --- 'home' => array(
'title' => $txt['home'],
'href' => $modSettings['sp_portal_mode'] == 3 && empty($context['disable_sp']) ? $modSettings['sp_standalone_url'] : $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),
'forum' => array(
'title' => empty($txt['sp-forum']) ? 'Forum' : $txt['sp-forum'],
'href' => $scripturl . ($modSettings['sp_portal_mode'] == 1 && empty($context['disable_sp']) ? '?action=forum' : ''),
'show' => in_array($modSettings['sp_portal_mode'], array(1, 3)) && empty($context['disable_sp']),
'sub_buttons' => array(
),
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
.
.
.
and so on
--- End code ---

You can modify the 'show' lines, like so:

--- Code: ---'show' => true,
--- End code ---
to

--- Code: ---'show' => false,
--- End code ---
or

--- Code: ---'show' => $current_action == 'forum',
--- End code ---

I'm pretty sure the alternative would work as well, allowing you to keep all the links when you're on the forum, but not show them elsewhere.

So you could also modify the forum button's 'show' clause from:

--- Code: ---'show' => in_array($modSettings['sp_portal_mode'], array(1, 3)) && empty($context['disable_sp']),
--- End code ---
to

--- Code: ---'show' => in_array($modSettings['sp_portal_mode'], array(1, 3)) && empty($context['disable_sp']) && $current_action = 'forum',
--- End code ---

rocknroller:
thank you Eliana  :)

That is cool! but won't work for me.

 :| I tried like this also:


--- Code: ---'show' => ($current_action == 'forum') ? 'true': 'false',
--- End code ---

and I added in the global $current_action I do not know whether it is necessary, but won't work.

Eliana Tamerin:
My bad on the last bit of code, it should be this:

--- Code: ---'show' => in_array($modSettings['sp_portal_mode'], array(1, 3)) && empty($context['disable_sp']) && $current_action == 'forum',
--- End code ---

And yours should be this:

--- Code: ---'show' => ($current_action == 'forum') ? true: false,
--- End code ---
But this code is superfluous. The $current_action == 'forum' statement will evaluate to true if true and false if false.

rocknroller:
Maybe I was not clear enough  :P

I want a forum button on (home page and SP pages), and only forum button.
I don't want other buttons(related to forum) to show on (home page and SP pages).
eg. Help, Profile, My messages, Members... etc.
 ;D
This code work for me:


--- Code: --- 'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => ($context['current_action']) == 'forum',
'sub_buttons' => array(
),
),
--- End code ---

but there is issue with other actions eg. action=help also make disappear help button. Can we make some kind of variable for which would know that user is on home page and portal pages.

Then use it example:


--- Code: --- 'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => !$home_page OR !$sp_pages,
'sub_buttons' => array(
),
),
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version