change modules's menu asssignment from "all" to "only selected" (even if all menuitems are checked).
should work the same way as with menu asssignment to "all" menu-items
call of ajax.php "$moduleObject = JModuleHelper::getModule('mod_' . $module, null);" returns Module id="0" (means module has not been found) and casts error404 with meessage:
LogicException: Module _ mod_modname is not published, you do not have access to it, or it's not assigned to the current menu item"_
checking module's authority, enablement or menu-assignment with JModuleHelper::getModule will not work and is not the correct way for module checking via ajax-interface. It should be done in other ways (e.g. like requiring a module-id in ajax-request additionally to the module-name an then do checking with modules table and module-menu-table)
Note that if no check is done at all - request will fail anyway later, if access to module is restricted or module is not published.
In Joomla, any URL request should contain an Itemid (the menu item). Otherwise you get unexpected results like what you described.
JRoute::_() takes care of that by using the active Itemid if none is specified. In case of your AJAX URL, you probably don't use SEF URLs (because they don't make sense there), and thus don't use JRoute::_(). So you have to add the active Itemid yourself to the request.
I think com_ajax must work without itemid, as it do not pass any parameters to the module helper,
so I would count it as
The docs.joomla.org web site is open for anyone to add/edit documentation -
it would be really helpful for others if you would add your findings and
advice to the docs
On 30 January 2015 at 10:36, Fedir Zinchuk email@example.com wrote:
I think com_ajax must work without itemid, as it do not pass any
parameters to the module helper
Reply to this email directly or view it on GitHub
Co-founder Joomla! and OpenSourceMatters Inc.
In the past was suggestion do check "whether module available" independant from Itemid https://github.com/joomla/joomla-cms/pull/3071/files#diff-4de1edbd5685ce87aa27e65ebca2b92bR89
I think com_ajax must work without itemid, as it do not pass any parameters to the module helper
com_ajax itself works fine without Itemid, as long as you don't make any requests which need one
Accessing a module is one of those cases where Joomla needs an Itemid to see if the module is available.
Imagine if you didn't make that check, then everyone could access the AJAX method even if the module is restricted to a specific usergroup or disabled. That opens the door for quite a few possible security issues.
Nevertheless this has not been documented with com_ajax but should as this is very important for developers.
It's not specific to com_ajax. It's a general rule that every request to Joomla has to contain an Itemid. Either explicit (by adding
&Itemid=123) or implicit (using a SEF URL with a menu alias). No exceptions.
|Closed_Date||0000-00-00 00:00:00||⇒||2015-01-30 11:33:30|
No Code Attached Yet