Scenario:
User is posting an ajax request to Joomla site (via com_ajax).
Inside the called method, I want to retrieve the entire html output of a known Joomla submenu (let's say /contact). The joomla submenu is only accessible to a different user than the one currently logged in.
- The method then returns the html back to the user.
OK, I can do #1 and #3, no problem. How can I do #2 ?
Things I've explored:
- Posting via cURL - I could not find a way to maintain session variables and surpass Joomla's CSRF protection mechanism.
- Using
ob_start
, then using theredirect
method ofJApplication
. This sends only the redirect headers. - Using JApplication->login to impersonate a user. This solves just a part of the problem. I am only mentioning it because if someone posts an answer via cURL, it'd have to tackle the authentication problem too.
"Solutions" that will not work (to save you some time):
require
/include
X file: No, because I want an entire url (which may contain multiple components/modules)- Have the user directly call the url (in this case /contact): No, for various business logic rules. Let's say for simplicity that the returned html output is "enriched" before being sent back.
com_ajax
, doesn't often happen :)