What?
I'm writing a Joomla 2.5.x component for logging time and projects and need a dropdown to have selectable options restricted to the logged-in user. This is specified in the XML file of the custom Joomla component and needs some SQL dependent on some dynamic variables.
Why?
In Joomla, the XML type of "sql" is extremely limited. The component I'm making has to ensure user's can only see their own projects and not everyone's:
copyrawstyler
SELECT * FROM #__projects ORDER BY name
-- yields all projects irrespective of which user is logged in
- SELECT * FROM
-
What I want:
copyrawstyler
SELECT * FROM #__projects WHERE user_id=<logged_in_user> ORDER BY name
- SELECT * FROM
Please Note: This article focuses on a front-end form dropdown. If you would like to see how to do modals for the admin panel, see my article
Joomla article modal with clear button for Joomla article selection.
How?Category: Joomla :: Article: 530