6 Posts
Bohors
5 years ago
4
Topic

Hi,

I am trying to retrieve the ID of the active user in the form (and not the logged on user => $user->id) in a SQL query (dynamic cascade)

SELECT a.id AS value, a.title AS text 
FROM #__usergroups AS a
JOIN #__user_usergroup_map AS b ON a.id = b.group_id
WHERE a.parent_id = 11 AND b.user_id = $user->id

$config["pk"] can not be used => Create content dynamiclly using code

then I get it in my request or have to go through a beforeStore ?

Thank you for your ideas :)

Get a VIP membership
4229 Posts
Kadministrator
5 years ago
2
Level 1

Sorry, but this is not clear, how does active user differ from logged in user? User logins are bound to sessions and you can only have one active user per session/app (one for front and one for back end).

6 Posts
Bohors
5 years ago
1
Level 2

Thanks for your feedback. 

I work on a form managing data of different individuals (joomla users). When editing a form, I have 2 users: the user who is logged on the current Joomla session and the user (or the user's record) that is being modified. I am trying to retrieve the ID of the user being modified in my sql request.

4229 Posts
Kadministrator
5 years ago
0
Level 3

If you are accessing users from some list than you have article id in the url, you can use $uri->get to get that value from url, than you only need to join #__cck_core table on this id as it hold both, id and pk for each record.

6 Posts
Bohors
5 years ago
0
Level 1

it works with $uri->getValue('id'), thank you :-)

Get a VIP membership