Get username for condition

Get username for condition

by Kalikautsar Kalikautsar -
Number of replies: 0

I made a new condition that check is the current username exist in my JENA Fuseki server. if it not exist, this condition will add it. So i put my code in is_available function of condition.php. as i read in other forum post i tried this code to get the current username:


public function is_available($not, \core_availability\info $info, $grabthelot, $userid) {

    global $USER;

       require_once("../config.php");

       require_login();

       $namabayi = $USER->username;


but it can't get the current username who currently login, because when i send the $namabayi to my Fuseki server, it was not detected. What is the code exactly to get the username of currently login user?


the directory is stil in my localhost, here C:\xampp\htdocs\moodle\availability\condition\kpsp\classes

Average of ratings: -