Moodle

prevent students from being able to start new discussion in Q and A forum type

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9
  • Fix Version/s: None
  • Component/s: Forum
  • Labels:
    None
  • Difficulty:
    Easy
  • Affected Branches:
    MOODLE_19_STABLE

Description

teachers asked me to disable the "start new discussion" button from student's view
when they navigate into a "Q and A" forum type. since most of them just start a new
discussion instead of opening a discussion started by the teacher and answering it
(as the teacher expect them too) and thus missing the whole point of Q and A forum.

to patch...
open moodle/mod/forum/lib.php (line 4692~)

change :
if (forum_user_can_post_discussion($forum, $currentgroup, $groupmode, $cm, $context) ||
($forum->type != 'news' and (isguestuser() or !isloggedin() or has_capability('moodle/legacy:guest', $context, NULL, false))) )
{

to:
if ( (forum_user_can_post_discussion($forum, $currentgroup, $groupmode, $cm, $context) ||
($forum->type != 'news' and (isguestuser() or !isloggedin() or has_capability('moodle/legacy:guest', $context, NULL, false))) )
and !(has_capability('moodle/legacy:student', $context, NULL, false) and $forum->type == 'qanda') )
{

maybe we should have a $CFG for this ? or maybe a better way to implement this ?
not sure. any feedback is very welcome

Issue Links

Activity

Hide
Nadav Kavalerchik added a comment -

now, it works

Show
Nadav Kavalerchik added a comment - now, it works
Hide
Charles Kelly added a comment -

I wonder if this couldt be made into an "option" in the "Update This Forum" section.

/course/modedit.php?update=20176&return=1

For example:

Show "Add New Question" button to students: Yes/No

This would be a very useful feature.

It might be useful for the "Standard forum for general use," too.

Show
Charles Kelly added a comment - I wonder if this couldt be made into an "option" in the "Update This Forum" section. /course/modedit.php?update=20176&return=1 For example: Show "Add New Question" button to students: Yes/No This would be a very useful feature. It might be useful for the "Standard forum for general use," too.
Hide
Charles Kelly added a comment -

Our temporary solution to this problem was to make a duplicate of our theme and rename it "NoForumButton" then add the following line into the style sheet.

/* Hide the forum "Add a new discussion topic" button */
#newdiscussionform{
display:none;
}

For this to work, teachers need to have the rights to set custom themes for their courses.

Teachers need to use a standard theme when writing questions (since they need to see the button), then switch to the "NoForumButton" theme, so students don't see the "Add a new discussion topic" button.

Also, note that this will affect all forums within the course, so if you can't live with that, then this solution won't work for you.

Show
Charles Kelly added a comment - Our temporary solution to this problem was to make a duplicate of our theme and rename it "NoForumButton" then add the following line into the style sheet. /* Hide the forum "Add a new discussion topic" button */ #newdiscussionform{ display:none; } For this to work, teachers need to have the rights to set custom themes for their courses. Teachers need to use a standard theme when writing questions (since they need to see the button), then switch to the "NoForumButton" theme, so students don't see the "Add a new discussion topic" button. Also, note that this will affect all forums within the course, so if you can't live with that, then this solution won't work for you.
Hide
Stephen Overall added a comment -

I think there may be a workaround for this problem by manually overriding student permissions for the Q and A forum.

Please see MDL-27735 where I've described a similar situation and workaround.

Show
Stephen Overall added a comment - I think there may be a workaround for this problem by manually overriding student permissions for the Q and A forum. Please see MDL-27735 where I've described a similar situation and workaround.

People

Vote (3)
Watch (3)

Dates

  • Created:
    Updated: