General developer forum

$USER does not display values

 
Picture of Waleed Sohail
$USER does not display values
 

Hey, Im making a plugin at question type level and I ran into a problem. The issue is that the Variable $USER is not working, I tried using  this and it works.

 

It works perfectly giving me the correct output. But when I write the exact same in here, In Moodle/question/type/mytype 

it doesnt display anything. Also tried including the test file too. It doesnt work aswell. 


It displays this only whereas it should display this:



The changed code is:


 
Average of ratings: -
Picture of Conn Warwicker
Re: $USER does not display values
Core developersParticularly helpful MoodlersPlugin developers

Try putting your:


global $USER

print_object($USER);


Inside the definition_inner function, see if it shows up there.


 
Average of ratings: Useful (1)