本文整理汇总了PHP中forum_tp_mark_posts_read函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_tp_mark_posts_read函数的具体用法?PHP forum_tp_mark_posts_read怎么用?PHP forum_tp_mark_posts_read使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forum_tp_mark_posts_read函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forum_tp_mark_discussion_read
/**
* Marks a whole discussion as read, for a given user
*
* @global object
* @global object
* @param object $user
* @param int $discussionid
* @return bool
*/
function forum_tp_mark_discussion_read($user, $discussionid) {
global $CFG, $DB;
$cutoffdate = time() - ($CFG->forum_oldpostdays*24*60*60);
$sql = "SELECT p.id
FROM {forum_posts} p
LEFT JOIN {forum_read} r ON (r.postid = p.id AND r.userid = ?)
WHERE p.discussion = ?
AND p.modified >= ? AND r.id is NULL";
if ($posts = $DB->get_records_sql($sql, array($user->id, $discussionid, $cutoffdate))) {
$postids = array_keys($posts);
return forum_tp_mark_posts_read($user, $postids);
}
return true;
}
示例2: forum_tp_mark_discussion_read
/**
* Marks a whole discussion as read, for a given user
*/
function forum_tp_mark_discussion_read($user, $discussionid)
{
global $CFG;
$cutoffdate = time() - $CFG->forum_oldpostdays * 24 * 60 * 60;
$sql = "SELECT p.id\n FROM {$CFG->prefix}forum_posts p\n LEFT JOIN {$CFG->prefix}forum_read r ON (r.postid = p.id AND r.userid = {$user->id})\n WHERE p.discussion = {$discussionid}\n AND p.modified >= {$cutoffdate} AND r.id is NULL";
if ($posts = get_records_sql($sql)) {
$postids = array_keys($posts);
return forum_tp_mark_posts_read($user, $postids);
}
return true;
}