bbp_get_reply_position_raw (intreply_id美元,inttopic_id美元)
通过直接查询DB以获取给定主题的应答,获取应答的位置。
描述
参数
- reply_id美元
-
(int)(必需)
- topic_id美元
-
(int)(必需)
源
function bbp_get_reply_position_raw($reply_id = 0, $topic_id = 0){//获取所需数据$reply_id = bbp_get_reply_id($reply_id);$topic_id = !Bbp_get_topic_id ($topic_id): bbp_get_reply_topic_id($reply_id);美元reply_position = 0;$reply_count = bbp_get_topic_reply_count($topic_id, false);if (!empty($reply_count)){//获取回复id的$topic_replies = bbp_get_all_child_ids($topic_id, bbp_get_reply_post_type());if (!empty($topic_replies)){//反转回复数组并搜索当前回复位置$topic_replies = array_reverse($topic_replies);$reply_position = array_search((string) $reply_id, $topic_replies);$reply_position++; //改变位置以弥补领先的主题文章$reply_position++;}}} return (int) $reply_position; }
更新日志
版本 | 描述 |
---|---|
bbPress (r3933) | 介绍了。 |