Skip to content

Commit

Permalink
Synchronization of group description and picture
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimonus committed Oct 25, 2020
1 parent e9787fc commit d489980
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
12 changes: 12 additions & 0 deletions classes/observers.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ public static function group_created(\core\event\group_created $event) {
$metagroup->courseid = $course->id;
$metagroup->idnumber = $group->id;
$metagroup->name = $group->name;
$metagroup->description = $group->description;
$metagroup->descriptionformat = $group->descriptionformat;
$metagroup->picture = $group->picture;
$metagroup->hidepicture = $group->hidepicture;
// No need to sync enrolmentkey, user should be able to enrol only on source course.
$metagroup->enrolmentkey = null;

groups_create_group($metagroup, false, false);
}
Expand All @@ -125,6 +131,12 @@ public static function group_updated(\core\event\group_updated $event) {

if ($metagroup = $DB->get_record('groups', array('courseid' => $course->id, 'idnumber' => $group->id))) {
$metagroup->name = $group->name;
$metagroup->description = $group->description;
$metagroup->descriptionformat = $group->descriptionformat;
$metagroup->picture = $group->picture;
$metagroup->hidepicture = $group->hidepicture;
// No need to sync enrolmentkey, user should be able to enrol only on source course.
$metagroup->enrolmentkey = null;

groups_update_group($metagroup, false, false);
}
Expand Down
6 changes: 6 additions & 0 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ function local_metagroups_sync(progress_trace $trace, $courseid = null) {
$metagroup->courseid = $parent->id;
$metagroup->idnumber = $group->id;
$metagroup->name = $group->name;
$metagroup->description = $group->description;
$metagroup->descriptionformat = $group->descriptionformat;
$metagroup->picture = $group->picture;
$metagroup->hidepicture = $group->hidepicture;
// No need to sync enrolmentkey, user should be able to enrol only on source course.
$metagroup->enrolmentkey = null;

$metagroup->id = groups_create_group($metagroup, false, false);
}
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'local_metagroups';
$plugin->release = '3.4';
$plugin->version = 2020061800;
$plugin->release = '3.6';
$plugin->version = 2020102601;
$plugin->requires = 2018051703; // Moodle 3.5.3 onwards.
$plugin->maturity = MATURITY_STABLE;

Expand Down

0 comments on commit d489980

Please sign in to comment.