General developer forum

How to get user id of current user in moodle?

 
Picture of Richard Oelmann
Re: How to get user id of current user in moodle?
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developersGroup Testers

If the user is logged on then $USER->id should work - but if you are writing your own code, you may have to declare the $USER variable as a global in your code. 

 
Average of ratings: -