Having an odd problem registering menu items/sections

bansh33 - Posted in Component Development 1 month ago

I'm having an odd problem when trying to register a new menu section, and the subsequent menu items within that section. Here's the code I'm using to register a new section:

ossn_register_menu_item('user_timeline', array(
                'name' => 'games',
                'href' => ossn_site_url("mygames"),
                'text' => 'GAMES',
        ));

The problem is that even though I've capitalized 'GAMES' in the 'text' parameter, it still shows up as lowercase ("games"), and the same is true for menu items that I add with ossnregistersections_menu() where I set 'section' to 'games' in the parameters. Anyone know what's going wrong?

Replies
us Bansh33 - Replied 1 month ago

thank you Z-Man, I see it now. I was really confused because I had removed the call to ossnprint() from within ossnregistermenuitem() but I see it in the file you pointed me to. Thanks again!

German ~Z~ Man Replied 1 month ago

see line #23 of themes/goblue/plugins/default/menus/user_timeline.php

Since ossn_print() returns a given key uncapitalized if no corresponding value can be found, 'GAMES' returns 'games'.

Thus, add something like 'com:banshgames:menu:games' => 'GAMES'; to your language file(s), and things should start to work

us Bansh33 - Replied 1 month ago

well, I was sort of able to fix this by adding a text-transform css rule for li.menu-section-blah and li.menu-section-item-blahitem but that seems like a hack to me. I have other components working that add menu sections and items in the same way, and those are added properly, with the correct case passed to the register functions. It seems that somewhere along the way, my text is somehow being set to lowercase, but I still cannot find where.