- Posts: 1
How To / General
Getting moodle user id in joomla plugin
- Mr Riddle
- Topic Author
- Offline
- New Member
-
Less
More
5 years 1 month ago #1
by Mr Riddle
Getting moodle user id in joomla plugin was created by Mr Riddle
Hi!
I'm trying to write module for Joomla. How can I get current logged in moodle user id?
With this:
I'm getting Joomla user id witch is not equal to the moodle id of the same user 
I was also trying this:
But I'm getting blank page.
Is it any simple way to get moodle user id in joomla module?
I'm trying to write module for Joomla. How can I get current logged in moodle user id?
With this:
Code:
JFactory::getUser();
$user_id = $user->id;

I was also trying this:
Code:
require_once(JUri::root()."/baza/config.php") ;
require_login();
$usr_id = $USER->id
Is it any simple way to get moodle user id in joomla module?
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7906
5 years 1 month ago #2
by Antonio Durán
Replied by Antonio Durán on topic Getting moodle user id in joomla plugin
Hi.
You can use a Joomdle call for that:
$moodle_user_id = JoomdleHelperContent::call_method ("user_id", $username);
You'll need to include the helper file to use the method.
Bear in mind that this is a web service call to Moodle, so it will use a HTTP connection each time.
You can use a Joomdle call for that:
$moodle_user_id = JoomdleHelperContent::call_method ("user_id", $username);
You'll need to include the helper file to use the method.
Bear in mind that this is a web service call to Moodle, so it will use a HTTP connection each time.
Please Log in or Create an account to join the conversation.