Commit d1571da6 authored by David Mudrak's avatar David Mudrak
Browse files

MDL-25068 forum: fixed error string usage

The string [cannotsubscribe,mod_forum] is supposed to be used for group
membership check only. I have fixed the two other usages of the string.
Note that the condition if (forum_subscribe()) was useless as the
function return true values only now after $DB conversion.
parent 9a3adb20
......@@ -132,13 +132,9 @@ if (forum_is_subscribed($user->id, $forum->id)) {
print_error('disallowsubscribe', 'forum', $_SERVER["HTTP_REFERER"]);
}
if (!has_capability('mod/forum:viewdiscussion', $context)) {
print_error('cannotsubscribe', 'forum', $_SERVER["HTTP_REFERER"]);
}
if (forum_subscribe($user->id, $forum->id) ) {
add_to_log($course->id, "forum", "subscribe", "view.php?f=$forum->id", $forum->id, $cm->id);
redirect($returnto, get_string("nowsubscribed", "forum", $info), 1);
} else {
print_error('cannotsubscribe', 'forum', $_SERVER["HTTP_REFERER"]);
print_error('noviewdiscussionspermission', 'forum', $_SERVER["HTTP_REFERER"]);
}
forum_subscribe($user->id, $forum->id);
add_to_log($course->id, "forum", "subscribe", "view.php?f=$forum->id", $forum->id, $cm->id);
redirect($returnto, get_string("nowsubscribed", "forum", $info), 1);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment