mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
community course MDL-19314 fix adding a community course to the community block
This commit is contained in:
parent
29323f27ed
commit
84e249b96f
@ -54,7 +54,7 @@ if ($add != -1 and $confirm and confirm_sesskey()) {
|
||||
$course->url = optional_param('courseurl', '', PARAM_URL);
|
||||
$course->imageurl = optional_param('courseimageurl', '', PARAM_URL);
|
||||
$community->add_community_course($course, $USER->id);
|
||||
$notificationmessage = $OUTPUT->notification(get_string('addedtoblock', 'hub', 'backup_'.$courseid.".zip"),
|
||||
$notificationmessage = $OUTPUT->notification(get_string('addedtoblock', 'hub'),
|
||||
'notifysuccess');
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ class community {
|
||||
public function add_community_course($course, $userid) {
|
||||
global $DB;
|
||||
|
||||
$community = $this->get_community_course($course->id, $userid);
|
||||
$community = $this->get_community_course($course->url, $userid);
|
||||
|
||||
if (empty($community)) {
|
||||
$community->userid = $userid;
|
||||
@ -69,9 +69,9 @@ class community {
|
||||
* @param integer $userid
|
||||
* @return array of course
|
||||
*/
|
||||
public function get_community_course($courseid, $userid) {
|
||||
public function get_community_course($courseurl, $userid) {
|
||||
global $DB;
|
||||
return $DB->get_record('block_community', array('id' => $courseid, 'userid' => $userid));
|
||||
return $DB->get_record('block_community', array('courseurl' => $courseurl, 'userid' => $userid));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user