Menu items keep an active status when clicked on and going to that page, unless they are Custom Links. How can one add custom link menu items to the script (or java script) so that they too keep an active state after being clicked on? In other words they should stay orange in their color (or whatever your site.css color is). Menu items like Helpdesk and Payment History MAINTAIN this active style. Custom Menu Items do not. ul.am-tabs li.active, ul.am-tabs li.normal:hover background: url("../img/tab-hover-bg.png") Thanks!
Hello, I am afraid it is a bit tricky in case of custom links but still possible. Please put the following code to site.php https://www.amember.com/docs/Site.php_file/ PHP: Am_Di::getInstance()->hook->add(Am_Event::USER_MENU, function(Am_Event $e) { $menu = $e->getMenu(); [$config, $items] = Am_Navigation_User::getNavigation(); $url = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); foreach ($config as $item) { if ($item['id'] == 'custom-link' && ($url == $item['config']['uri'] || $_SERVER['REQUEST_URI'] == $item['config']['uri'])) { $id = 'custom-link-' . substr(crc32($item['config']['uri']), 0, 8); $menu->findOneById($id)->setActive(true); return; } }});
@caesar I'm getting an error from the following line of code [$config, $items] = Am_Navigation_User::getNavigation(); Exception ParseError:syntax error, unexpected '=' at line 88 in file /home4/summitt8/public_html/kohera3d/accounts/application/configs/site.php Am_App->bootstrap [ bootstrap.php : 20 ] require_once [ index.php : 92 ]
You need to either upgrade PHP to latest version or change it to: PHP: list($config, $items) = Am_Navigation_User::getNavigation();
Thank you for the help and effort. Unfortunately it's not working for custom menu items using custom links. I might just have to give up.
I am sure it works. I tested it on my local setup. Please contact me in helpdesk: https://www.amember.com/support and refer to this forum thread. I will check what is wrong with your installation and fix it. Best Regards.