Tim, try $USER->id
once you've done the require_once() there are a wealth of parameters available to you in Moodle. $USER is just one of them. ($CFG, $COURSE would be others).
When you're learning it's quite useful to see what is contained in some of these variables. If you haven't done this yet try (in a php page):
I also included it as a file with pretty formatting and a couple other variables. Really helps getting you used to moodle development.
Thanks Greg I'd just about managed to figure out using $USER->id was the way to do it. That file you attached is excellent, I can see that coming in really handy as I continue to get to grips with moodle development, thanks!
From one newbie to another Happy to help!
Fantastic page of vars
Thanks
Yup, this is very common way to debug Moodle code. I often use
print_object($something); die(); // DONOTCOMMIT
So often that I have a ViM macro to produce such line. Note the comment I use there. Then I can easily check (grep) I have no forgotten trace point in the code.
print_object($something); die(); // DONOTCOMMIT
So often that I have a ViM macro to produce such line. Note the comment I use there. Then I can easily check (grep) I have no forgotten trace point in the code.
i cant download your moodlevars.php