how to map joomla users to moodle ones?

More
12 years 2 months ago #1 by Alex
Hi, i'm trying to obtain the list of all moodle users by a script in joomla... i was trying using the Moodle WS but it seems not work (another topic)... so i wish to know how to obtain, from the list of joomla users, the corresponding moodle records.... using the Moodle WS exist the function which gets the users by id, but i know just the 'username' (unique).
thanks for all responses!

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #2 by Antonio Durán
Replied by Antonio Durán on topic how to map joomla users to moodle ones?
You can check functions:
getMoodleUsers
getAllUsers
in administrator/components/com_joomdle/helpers/content.php

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #3 by Alex
Replied by Alex on topic how to map joomla users to moodle ones?
thanks Antonio... but i'm trying to make these functions works in a component without results... the following code fails at the require:once... i'm pretty confuse about the way to use the JoomdleHelperContent class.

require_once(JURI::root()."administrator/components/com_joomdle/helpers/content.php");
$joomdleHelper = new JoomdleHelperContent();
$res = $joomdleHelper->getMoodleUsers (0, 20, "firstname", "desc", "");

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #4 by Antonio Durán
Replied by Antonio Durán on topic how to map joomla users to moodle ones?
JURI:root returns a URL.
You need this:
require_once(JPATH_ADMINISTRATOR.'/components/com_joomdle/helpers/content.php');

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago - 12 years 2 months ago #5 by Alex
Replied by Alex on topic how to map joomla users to moodle ones?
thanks... it works but the result is not what i need...
if i call getMoodleUsers(0, 2, "name", "desc", "rts"); or if i call getAllUsers(0, 2, "name", "desc", "rts"); in the result for both cases i have the id (758) of joomla account.. instead i need the id of correspondent moodle one..

Moreover if i call getJoomdleUsers(0, 2, "name", "desc", "rts"); the result is an SQL error because it tries to run an sql query with "rts" as column (but the query seems to be correct)..
Last edit: 12 years 2 months ago by Alex.

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #6 by Antonio Durán
Replied by Antonio Durán on topic how to map joomla users to moodle ones?
There is no Joomdle function to return Moodle ids for all users.

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago - 12 years 2 months ago #7 by Alex
Replied by Alex on topic how to map joomla users to moodle ones?
And there is any function to return moodle ids using a search query?... For example if i had a joomla user with joomla id 758 and i know his username in moodle, how can i get its moodle id?
Last edit: 12 years 2 months ago by Alex.

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #8 by Antonio Durán
Replied by Antonio Durán on topic how to map joomla users to moodle ones?
You can use user_id joomdle function.

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #9 by Alex
Replied by Alex on topic how to map joomla users to moodle ones?
and where is defined?

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #10 by Antonio Durán
Replied by Antonio Durán on topic how to map joomla users to moodle ones?
All functions code is in moodle/auth/joomdle/auth.php

Please Log in or Create an account to join the conversation.