I want user roles in any part of my block not necessary in footer, kindly help me as I am newbie in php and moodle too, here below is the code.
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;}
}