PHP Developer / Moodle Developer

PHP Moodle Developer
Bartosz
Hornik
About me I'm PHP developer with 13 years of experience. I've prepared Moodle/Totara custom development for last 5 years. I built my first software when I was 9 years old. Welcome to my site!

Częstochowa, Poland
+48 668 690 844
bartosz.hornik@gmail.com
www.internetstudio.pl

Assign system role in Moodle

Back to Moodle code tips

# moodle# role

This is an example how to assign the "coursecreator" role for the user. This is a default Moodle role which gives permissions for creating new courses and edit them.

global $CFG, $DB;
require_once($CFG->dirroot . '/lib/accesslib.php');
$sql = "select id from {role} where shortname = :sn";
$role = $DB->get_record_sql($sql, array('sn' => 'coursecreator'));
$context = \context_system::instance();
role_assign($role->id, $userid, $context->id);

Back to Moodle code tips
PHP Moodle Developer
I'm offering wide range of development for your Moodle / Totara LMS system. As a Moodle developer I can prepare for you fency dashboards, new blocks, new local plugins, report builder custom sources and other types of plugins. I can extend default Moodle / Totara functionality according to your ideas and needs. Because I have strong experience in general PHP field I can implement an application from scratch using any modern framework like Laravel or Phalcon -- Bartosz Hornik, PHP Moodle developer.