2

Sorry for asking another question, but I really need an answer on this.

My module is called mod_improvedmenu. I've been experimenting a bit (I'm still learning, I need some help on this subject because it's a returning issue), and the thing is, when I do a var_dump on the $module variable, it returns an array with all the information I need.

However, when I set that $module to be mod_improvedmenu

$module = JModuleHelper::getModule('mod_improvedmenu');
var_dump($module);

It returns an empty array. It should work, but it doesn't. I also checked the database if there happens to be 2 modules with the same name, but there's not.

Do you have any idea what could be going on here?
When I do the same thing with simply mod_menu, it works just fine.

2

You need to ensure it meets the following criteria:

  1. It is enabled
  2. It is assigned to the current menu item or is assigned to all menu items
  3. The user meets the access level requirements.

Note: When using your code in an external PHP file, the module must be assigned to all pages

| improve this answer | |
  • All of those are correct. I meet every criteria. – Hocho Nov 5 '14 at 9:47
  • ok, and have you ensured you're running the latest version of the Joomla 2.5 series? (2.5.27). If not then please update as it could be a bug – Lodder Nov 5 '14 at 9:48
  • I'm on .27 now, still got the same issue. – Hocho Nov 5 '14 at 10:01
  • Am I right in assuming you're still trying to do this in an external PHP file? – Lodder Nov 5 '14 at 10:02
  • Yes. But, for tests sake I'm using a new module new, and in the default file I did a var_dump on the $module variable, which worked fine, but as soon as I set it to 'mod_mymodule' it returns an empty array eventhough I am using the right module name. – Hocho Nov 5 '14 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.