/** * Find this user. * @param int $postid * @param string $author * @return boolean */ function forumng_find_this_user($postid, $author = null) { global $CFG, $DB; require_once $CFG->libdir . '/dmllib.php'; if (!$author) { return true; } $where = "WHERE p.id = ? AND p.asmoderator != ?"; $params = array($postid, mod_forumng::ASMODERATOR_ANON); list($morewhere, $moreparams) = forumng_get_author_sql($author); $where .= $morewhere; $params = array_merge($params, $moreparams); $sql = "SELECT p.id, u.username, u.firstname, u.lastname\n FROM {forumng_posts} p\n INNER JOIN {user} u ON p.userid = u.id\n {$where}"; return $DB->record_exists_sql($sql, $params); }
/** * Find this usr. * @param int $groupid * @param string $author * @return boolean */ function forumng_find_this_user($postid, $author = null) { global $CFG; require_once $CFG->libdir . '/dmllib.php'; if (!$author) { return true; } $where = "WHERE p.id={$postid} "; $where .= forumng_get_author_sql($author); $sql = "SELECT p.id, u.username, u.firstname, u.lastname\n FROM {$CFG->prefix}forumng_posts p\n INNER JOIN {$CFG->prefix}user u ON p.userid = u.id\n {$where}"; if ($posts = get_record_sql($sql)) { return true; } return false; }