From: moodler You have \$a to edit it if you want to make any changes.";
$string['postmailinfo'] = "This is a copy of a message posted on the \$a website.
diff --git a/lang/en/help/forum/allowdiscussions.html b/lang/en/help/forum/allowdiscussions.html
index 204980988a..fac7554c56 100644
--- a/lang/en/help/forum/allowdiscussions.html
+++ b/lang/en/help/forum/allowdiscussions.html
@@ -1,9 +1,20 @@
- Allowing new discussions Allowing new posts For most forums you will want to allow non-teachers to start new
- discussion topics (threads).
+ This option allows you to restrict students from posting
+ new content in this forum.
+
+ For most forums you will want to leave students unrestricted
+ and choose the first option to allow them to start new discussion
+ topics (threads), and also to post replies within those threads.
Sometimes, however, you will want to disable this ability. For
example, this is useful for the News forum when you only want
teachers to post new items that appear on the course main page.
- Students will still be able to REPLY to existing posts though.
+ In this case you might choose the third option "No discussions, no replies".
+
+ Sometimes you might want to only allow teachers to start new
+ discussions, but still allow students to reply within those
+ threads (for example within the news forum on the site home page).
+ In this case you would choose the second option, "No discussions, but
+ replies are allowed".
+
diff --git a/lang/en/moodle.php b/lang/en/moodle.php
index 22d81cbada..4f278df9da 100644
--- a/lang/en/moodle.php
+++ b/lang/en/moodle.php
@@ -216,7 +216,7 @@ $string['listofallpeople'] = "List of all people";
$string['license'] = "GPL License";
$string['livelogs'] = "Live logs from the past hour";
$string['location'] = "Location";
-$string['loggedinas'] = "You are logged in as \$a.";
+$string['loggedinas'] = "You are logged in as \$a ";
$string['loggedinnot'] = "You are not logged in.";
$string['login'] = "Login";
$string['loginas'] = "Login as";
diff --git a/mod/forum/db/mysql.sql b/mod/forum/db/mysql.sql
index d3680b2111..3227e42dd2 100644
--- a/mod/forum/db/mysql.sql
+++ b/mod/forum/db/mysql.sql
@@ -8,7 +8,8 @@ CREATE TABLE forum (
type enum('single','news','general','social','eachuser','teacher') NOT NULL default 'general',
name varchar(255) NOT NULL default '',
intro text NOT NULL,
- open tinyint(1) unsigned NOT NULL default '0',
+ opendiscuss tinyint(1) unsigned NOT NULL default '1',
+ openpost tinyint(1) unsigned NOT NULL default '1',
assessed tinyint(1) unsigned NOT NULL default '0',
forcesubscribe tinyint(1) unsigned NOT NULL default '0',
timemodified int(10) unsigned NOT NULL default '0',
diff --git a/mod/forum/lib.php b/mod/forum/lib.php
index b6a8c34392..a427cffdd6 100644
--- a/mod/forum/lib.php
+++ b/mod/forum/lib.php
@@ -20,6 +20,10 @@ $FORUM_POST_RATINGS = array ("3" => get_string("postrating3", "forum"),
"2" => get_string("postrating2", "forum"),
"1" => get_string("postrating1", "forum") );
+$FORUM_OPEN_MODES = array ("2" => get_string("openmode2", "forum"),
+ "1" => get_string("openmode1", "forum"),
+ "0" => get_string("openmode0", "forum") );
+
$FORUM_SHORT_POST = 300; // Less than this is "short"
$FORUM_LONG_POST = 600; // More than this is "long"
@@ -43,21 +47,21 @@ function forum_get_course_forum($courseid, $type) {
case "news":
$forum->name = get_string("namenews", "forum");
$forum->intro = get_string("intronews", "forum");
- $forum->open = 0;
+ $forum->open = 1; // 0 - no, 1 - posts only, 2 - discuss and post
$forum->assessed = 0;
$forum->forcesubscribe = 1;
break;
case "social":
$forum->name = get_string("namesocial", "forum");
$forum->intro = get_string("introsocial", "forum");
- $forum->open = 1;
+ $forum->open = 2; // 0 - no, 1 - posts only, 2 - discuss and post
$forum->assessed = 0;
$forum->forcesubscribe = 0;
break;
case "teacher":
$forum->name = get_string("nameteacher", "forum");
$forum->intro = get_string("introteacher", "forum");
- $forum->open = 0;
+ $forum->open = 0; // 0 - no, 1 - posts only, 2 - discuss and post
$forum->assessed = 0;
$forum->forcesubscribe = 0;
break;
@@ -1045,10 +1049,22 @@ function forum_user_can_post_discussion($forum) {
} else if (isteacher($forum->course)) {
return true;
} else {
- return $forum->open;
+ return ($forum->open == 2);
}
}
+function forum_user_can_post($forum) {
+// $forum is an object
+ global $USER;
+
+ if ($forum->type == "teacher") {
+ return isteacher($forum->course);
+ } else if (isteacher($forum->course)) {
+ return true;
+ } else {
+ return $forum->open;
+ }
+}
function forum_get_discussions($forum="0", $forum_sort="DESC", $user=0) {
if ($user) {
@@ -1148,8 +1164,9 @@ function forum_print_discussion($course, $forum, $discussion, $post, $mode) {
global $USER;
$ownpost = ($USER->id == $post->user);
+ $reply = forum_user_can_post($forum);
- forum_print_post($post, $course->id, $ownpost, $reply=true, $link=false, $rate=false);
+ forum_print_post($post, $course->id, $ownpost, $reply, $link=false, $rate=false);
forum_print_mode_form($discussion->id, $mode);
@@ -1171,16 +1188,16 @@ function forum_print_discussion($course, $forum, $discussion, $post, $mode) {
case -1 : // Flat descending
default:
echo "";
- forum_print_posts_flat($post->discussion, $course->id, $mode, $forum->assessed);
+ forum_print_posts_flat($post->discussion, $course->id, $mode, $forum->assessed, $reply);
echo "
";
break;
case 2 : // Threaded
- forum_print_posts_threaded($post->id, $course->id, 0, $forum->assessed);
+ forum_print_posts_threaded($post->id, $course->id, 0, $forum->assessed, $reply);
break;
case 3 : // Nested
- forum_print_posts_nested($post->id, $course->id, $forum->assessed);
+ forum_print_posts_nested($post->id, $course->id, $forum->assessed, $reply);
break;
}
@@ -1192,10 +1209,9 @@ function forum_print_discussion($course, $forum, $discussion, $post, $mode) {
}
}
-function forum_print_posts_flat($discussion, $course, $direction, $assessed) {
+function forum_print_posts_flat($discussion, $course, $direction, $assessed, $reply) {
global $USER;
- $reply = true;
$link = false;
if ($direction < 0) {
@@ -1217,10 +1233,9 @@ function forum_print_posts_flat($discussion, $course, $direction, $assessed) {
}
}
-function forum_print_posts_threaded($parent, $course, $depth, $assessed) {
+function forum_print_posts_threaded($parent, $course, $depth, $assessed, $reply) {
global $USER;
- $reply = true;
$link = false;
if ($posts = get_records_sql("SELECT p.*, u.id as userid, u.firstname, u.lastname, u.email, u.picture
@@ -1242,7 +1257,7 @@ function forum_print_posts_threaded($parent, $course, $depth, $assessed) {
echo "
print_string("allowdiscussions", "forum", "$course->student") ?>:
print_string("allowdiscussions", "forum", strtolower("$course->student")) ?>:
print_string("allowratings", "forum") ?>:
print_string("forcesubscribeq", "forum") ?>: