/** * @covers ::bbp_get_forum_last_topic_author_id */ public function test_bbp_get_forum_last_topic_author_id() { $u = $this->factory->user->create(); $c = $this->factory->forum->create(array('forum_meta' => array('forum_type' => 'category', 'status' => 'open'))); $f = $this->factory->forum->create(array('post_author' => $u, 'post_parent' => $c, 'forum_meta' => array('forum_id' => $c, 'forum_type' => 'forum', 'status' => 'open'))); $t = $this->factory->topic->create(array('post_parent' => $f, 'post_author' => $u, 'topic_meta' => array('forum_id' => $f))); $this->factory->reply->create(array('post_parent' => $t, 'post_author' => $u, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t))); // Get the forums last author id. $forum = bbp_get_forum_last_topic_author_id($f); $this->assertSame($u, $forum); // Get the categories last author id. $forum = bbp_get_forum_last_topic_author_id($c); $this->assertSame($u, $forum); }
/** * Return link to author of last topic of forum * * @since bbPress (r2625) * * @param int $forum_id Optional. Forum id * @uses bbp_get_forum_id() To get the forum id * @uses bbp_get_forum_last_topic_author_id() To get the forum's last * topic's author id * @uses bbp_get_user_profile_link() To get the author's profile link * @uses apply_filters() Calls 'bbp_get_forum_last_topic_author_link' * with the author link and forum id * @return string Forum's last topic's author link */ function bbp_get_forum_last_topic_author_link($forum_id = 0) { $forum_id = bbp_get_forum_id($forum_id); $author_id = bbp_get_forum_last_topic_author_id($forum_id); $author_link = bbp_get_user_profile_link($author_id); return apply_filters('bbp_get_forum_last_topic_author_link', $author_link, $forum_id); }