/** * Filter search result. * @param object $result * @return boolean */ function forumng_exclude_words_filter($result) { global $forumngfilteroptions; $author = $forumngfilteroptions->author; $daterangefrom = $forumngfilteroptions->datefrom; $daterangeto = $forumngfilteroptions->dateto; if (!isset($forumngfilteroptions->asmoderator)) { $forumngfilteroptions->asmoderator = false; } // Filter the output based on the input string for "Author name" field. if (!forumng_find_this_user($result->intref1, $author)) { return false; } // Filter the output based on the input value for 'Posted as Moderator' field. if (!forumng_check_asmoderator($result->intref1, $forumngfilteroptions->asmoderator)) { return false; } // Filter the output based on input date for "Date range from" field. if ($daterangefrom && $daterangefrom > $result->timemodified) { return false; } // Filter the output based on input date for "Date range to" field. if ($daterangeto && $daterangeto < $result->timemodified) { return false; } return true; }
/** * Filter search result. * @param object $result * @return boolean */ function forumng_exclude_words_filter($result) { $author = trim(optional_param('author', null, PARAM_RAW)); $drfa = optional_param('daterangefrom', 0, PARAM_INT); $drta = optional_param('daterangeto', 0, PARAM_INT); // Filter the output based on the input string for "Author name" field if (!forumng_find_this_user($result->intref1, $author)) { return false; } // Filter the output based on input date for "Date range from" field if (count($drfa) > 1) { $daterangefrom = make_timestamp($drfa['year'], $drfa['month'], $drfa['day'], $drfa['hour'], $drfa['minute'], 0); if ($daterangefrom && $daterangefrom > $result->timemodified) { return false; } } // Filter the output based on input date for "Date range to" field if (count($drta) > 1) { $daterangeto = make_timestamp($drta['year'], $drta['month'], $drta['day'], $drta['hour'], $drta['minute'], 0); if ($daterangeto && $daterangeto < $result->timemodified) { return false; } } return true; }