这个函数的访问被标记为私有。这意味着它不打算被插件或主题开发人员使用,只在其他核心功能。这里列出了它的完整性。
BBP_Forums_Group_Extension:: maybe_map_permalink_to_group (intpost_id美元,$ url=假)
也许映射一个论坛论坛/主题/回复永久链接到相应的组
描述
参数
- post_id美元
-
(int)(必需)
返回
(保证金)如果不是一个小组论坛的帖子,早
源
private function maybe_map_permalink_to_group($post_id = 0, $url = false) {switch (get_post_type($post_id)){//回复case bbp_get_reply_post_type(): $topic_id = bbp_get_reply_topic_id($post_id);$forum_id = bbp_get_reply_forum_id($post_id);$url_end = trailingslashit($this->reply_slug)。Get_post_field ('post_name', $post_id);打破;// Topic case bbp_get_topic_post_type(): $topic_id = $post_id;$forum_id = bbp_get_topic_forum_id($post_id);$url_end = trailingslashit($this->topic_slug)。Get_post_field ('post_name', $post_id);打破; // Forum case bbp_get_forum_post_type() : $forum_id = $post_id; $url_end = ''; //get_post_field( 'post_name', $post_id ); break; // Unknown default : return $url; break; } // Get group ID's for this forum $group_ids = bbp_get_forum_group_ids( $forum_id ); // Bail if the post isn't associated with a group if ( empty( $group_ids ) ) return $url; // @todo Multiple group forums/forum groups $group_id = $group_ids[0]; $group = groups_get_group( array( 'group_id' => $group_id ) ); if ( bp_is_group_admin_screen( $this->slug ) ) { $group_permalink = trailingslashit( bp_get_group_admin_permalink( $group ) ); } else { $group_permalink = trailingslashit( bp_get_group_permalink( $group ) ); } return trailingslashit( trailingslashit( $group_permalink . $this->slug ) . $url_end ); }