I want to get the userid from:
JavaScript
x
["userid":"course_modinfo":private]=>
string(1) "5"
Here value from moodle $mod in cm info variable, I have tried var_dump($mod->userid);
but it returns nothing.
JavaScript
object(cm_info)#355 (40) {
["modinfo":"cm_info":private]=>
object(course_modinfo)#339 (7) {
["course":"course_modinfo":private]=>
object(stdClass)#354 (33) {
.
["userid":"course_modinfo":private]=>
string(1) "5"
["sections":"course_modinfo":private]=>
array(4) {
[0]=>
array(1) {
Advertisement
Answer
You can use the global variable:
JavaScript
$USER->id
Check this out How to get user id of current user in moodle?