Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
"FORUM/MDL-15968, respect mod/forum:viewqandawithoutposting in forum_…
…search_posts, merged from 1.9"
  • Loading branch information
dongsheng committed Mar 3, 2009
1 parent 7f92f0a commit ad9c22a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mod/forum/lib.php
Expand Up @@ -1873,7 +1873,11 @@ function forum_search_posts($searchterms, $courseid=0, $limitfrom=0, $limitnum=5
$params = array('userid'=>$USER->id, 'timestart'=>$now, 'timeend'=>$now);
}

if ($forum->type == 'qanda') {
$cm = get_coursemodule_from_instance('forum', $forumid);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);

if ($forum->type == 'qanda'
&& !has_capability('mod/forum:viewqandawithoutposting', $context)) {
if (!empty($forum->onlydiscussions)) {
list($discussionid_sql, $discussionid_params) = $DB->get_in_or_equal($forum->onlydiscussions, SQL_PARAMS_NAMED, 'qanda0');
$params = array_merge($params, $discussionid_params);
Expand Down

0 comments on commit ad9c22a

Please sign in to comment.