Not Getting User roles, Stuck At This

Viewed 30
class block_add extends block_base {

    function init() {
        $this->title = get_string('pluginname', 'block_add');

    }

    function applicable_formats() {
        return array('all' => true, 'tag' => false);
    }

    function specialization() {
        $this->title = isset($this->config->title) ? $this->config->title : get_string('newblock', 'block_add');
    }

    function instance_allow_multiple() {
        return true;
    }

    function get_content() {

        global $USER,$DB;

        if ($this->content !== NULL) {
            return $this->content;
        }

        $this->content = new stdClass();
        $this->content->footer= $DB->get_records('role_assignments', ['userid' => $user->id]);
        return $this->content;
    }
    
    function has_config() {return true;}
}

I am a newbie getting stuck at this, kindly help me in this, not getting value from DB in my block, i am new to moodle as well as in php($this->content->footer= $DB->get_records('role_assignments', ['userid' => $user->id]);).

0 Answers
Related