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();
$roles = $DB->get_records('role_capabilities',['userid'=>$USER->id]);->(// in this lines i am getting error "error readig from database")
var_dump($roles);
foreach ($roles as $role) {
$this->content->footer .= "Role Id = ".$role->contextid."</br>"."Context Id = ".$role->contextid."</br>"."Permission = ".$role->capability."</br>" ;
}
}
function has_config() {return true;}
}
i am getting "error reading from database" idk why, i am trying to print all assigned capabilities of logged-in user (for example: Admin),i am newbie in php as well on Moodle