WHen a guest hits reply, they now get told they have to enrol and

get sent there.   In manual enrolment they are returned to the post
(eventually all the plugins should do that).
This commit is contained in:
moodler
2006-10-20 17:48:59 +00:00
parent c1bfa6076c
commit f7396c7867
3 changed files with 18 additions and 4 deletions
+8 -2
View File
@@ -75,7 +75,7 @@ function print_entry($course) {
print_error('couldnotassignrole');
}
if ($SESSION->wantsurl) {
if (!empty($SESSION->wantsurl)) {
$destination = $SESSION->wantsurl;
unset($SESSION->wantsurl);
} else {
@@ -86,7 +86,13 @@ function print_entry($course) {
} else if (!empty($_GET['cancel'])) {
unset($SESSION->wantsurl);
redirect($CFG->wwwroot);
if (!empty($SESSION->enrolcancel)) {
$destination = $SESSION->enrolcancel;
unset($SESSION->enrolcancel);
} else {
$destination = $CFG->wwwroot;
}
redirect($destination);
}
}
+2 -1
View File
@@ -1468,9 +1468,10 @@ $string['yahooid'] = 'Yahoo ID';
$string['yes'] = 'Yes';
$string['youareabouttocreatezip'] = 'You are about to create a zip file containing';
$string['youaregoingtorestorefrom'] = 'You are about to start the restore process for';
$string['youneedtoenrol'] = 'To perform that action you need to enrol in this course.';
$string['yourlastlogin'] = 'Your last login was';
$string['yourself'] = 'yourself';
$string['yourteacher'] = 'your $a';
$string['zippingbackup'] = 'Zipping backup';
?>
?>
+8 -1
View File
@@ -376,10 +376,17 @@
if (! $course = get_record("course", "id", $discussion->course)) {
error("The course number was incorrect ($discussion->course)");
}
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
if (! forum_user_can_post($forum)) {
error("Sorry, but you can not post in this forum.");
if (has_capability('moodle/legacy:guest', $coursecontext, NULL, false)) { // User is a guest here!
$SESSION->wantsurl = $FULLME;
$SESSION->enrolcancel = $_SERVER['HTTP_REFERER'];
redirect($CFG->wwwroot.'/course/enrol.php?id='.$course->id, get_string('youneedtoenrol'));
} else {
print_error('nopostforum', 'forum');
}
}
if ($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {