Skip to main content
Highlighted menu item Started by Burke Knight · · Read 8355 times 0 Members and 1 Guest are viewing this topic. previous topic - next topic

Highlighted menu item

Okay, working on something on my site, and noticed, after made menu button on top level main menu, that when go to the page, it reverts to the "Home" menu item being highlighted. How would I change the Active menu item to be my menu button?

Here's the code for the button:

Code: [Select]
		'images' => array(
'title' => $txt['imagespage'],
'href' => $scripturl . '?page=images',
'data-icon' => 'i-picture',
'show' => true,
),

Re: Highlighted menu item

Reply #1

Also, I'd like to know if there's a way to make Custom Title be able to parse BBC?
I'd like the staff to be able to place an image there with the img bbc.

Re: Highlighted menu item

Reply #2

Quote from: Burke Knight – How would I change the Active menu item to be my menu button?
The simplest should be to set $context['current_action'] = 'images' ... another way for non simple actions is to set 'action_hook' => true, in your images array.  This will then trigger a call to the integration hook integrate_current_action (to which you registered your program hook).  Then in that function you can decide if the action is yours.in Load.php find 'title' => !empty($modSettings['titlesEnable']) ? $profile['usertitle'] : '', and change that to 'title' => !empty($modSettings['titlesEnable']) ? $parsers->parseCustomFields($profile['usertitle']) : '',  I think that will work.



Re: Highlighted menu item

Reply #3

Active menu item...
I had tried the $context one, as I didn't use hooks, but straight edit for the button.
However, was not sure where to add it, and if added to the button code in menu, it works, but all pages of site seems to use it.



Custom title worked. :)



Found another issue, with guests:

Code: [Select]
Type of error: Undefined
Notice: Undefined offset: 1
/index.php?topic=696.0
File: /sources/BrowserDetector.class.php
Line: 334

Line: 334
Code: [Select]
			if (trim($match[1]) >= 15)

Re: Highlighted menu item

Reply #4

Did you try adding that inside the function you are calling ... again I think that would work but it may be to late in the process.

The BrowserDetector thing is fixed in 1.1.10 see https://github.com/elkarte/Elkarte/commit/08468d3c690240954fa09918bca9dcc639dbc1ce

I'm working to get 1.1.10 out soon, just looking around for any remaining issues