## General developer forum

### Question on insert_record() function

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Re: Question on insert_record() function

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.

Average of ratings: -
Re: Question on insert_record() function

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! Average of ratings: - Re: Question on insert_record() function From one newbie to another Happy to help! Average of ratings: - Re: Question on insert_record() function Fantastic page of vars Thanks Average of ratings: - Re: Question on insert_record() function 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.

Average of ratings: Useful (1)
Re: Question on insert_record() function