Esempio n. 1
0
 /**
  * @covers ::bbp_topic_last_reply_title
  * @covers ::bbp_get_topic_last_reply_title
  */
 public function test_bbp_get_topic_last_reply_title()
 {
     $f = $this->factory->forum->create();
     $t = $this->factory->topic->create(array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     $title = bbp_get_topic_last_reply_title($t);
     $this->assertSame('', $title);
     $this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     $title = bbp_get_topic_last_reply_title($t);
     $this->assertSame('Reply To: ' . bbp_get_topic_title($t), $title);
 }
Esempio n. 2
0
/**
 * Returns link to the most recent activity inside a topic, complete
 * with link attributes and content.
 *
 * @since 2.0.0 bbPress (r2625)
 *
 * @param int $topic_id Optional. Topic id
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_get_topic_last_reply_url() To get the topic last reply url
 * @uses bbp_get_topic_last_reply_title() To get the reply title
 * @uses bbp_get_topic_last_active_time() To get the topic freshness
 * @uses apply_filters() Calls 'bbp_get_topic_freshness_link' with the
 *                        link and topic id
 * @return string Topic freshness link
 */
function bbp_get_topic_freshness_link($topic_id = 0)
{
    $topic_id = bbp_get_topic_id($topic_id);
    $link_url = bbp_get_topic_last_reply_url($topic_id);
    $title = bbp_get_topic_last_reply_title($topic_id);
    $time_since = bbp_get_topic_last_active_time($topic_id);
    if (!empty($time_since)) {
        $anchor = '<a href="' . esc_url($link_url) . '" title="' . esc_attr($title) . '">' . esc_html($time_since) . '</a>';
    } else {
        $anchor = esc_html__('No Replies', 'bbpress');
    }
    return apply_filters('bbp_get_topic_freshness_link', $anchor, $topic_id, $time_since, $link_url, $title);
}
Esempio n. 3
0
?>
</div>
		<div class="topic-reply-counts">Inlägg: <?php 
bbp_show_lead_topic() ? bbp_forum_reply_count() : bbp_forum_post_count();
?>
</div>
	</li>

	<li class="bbp-forum-freshness col-lg-3">

		<div class="last-posted-topic-title">
			<a href="<?php 
echo bbp_get_forum_last_topic_permalink();
?>
"><?php 
echo bbp_get_topic_last_reply_title(bbp_get_forum_last_active_id());
?>
</a>
		</div>
		<div class="last-posted-topic-user">av 
		<span class="bbp-author-avatar"><?php 
echo get_avatar(bbp_get_forum_last_reply_author_id(), '14');
?>
 </span>
			<?php 
echo bbp_get_user_profile_link(bbp_get_forum_last_reply_author_id());
?>
		</div>
		<div class="last-posted-topic-time">
			<?php 
echo bbp_get_forum_last_active_time();
function st_get_last_poster_block($subforum_id = "")
{
    if (!empty($subforum_id)) {
        // Main forum display with sub forums
        $st_forum_topic_count_two = bbp_get_forum_topic_count($subforum_id);
        if ($st_forum_topic_count_two == 0) {
            $output = "<div class='last-posted-topic-title no-topics'>";
            $output .= "No Topics";
        } else {
            $output = "<div class='last-posted-topic-title'>";
            // Get and crop title lenth if needed
            $st_topic_last_reply_title = bbp_get_topic_last_reply_title(bbp_get_forum_last_active_id($subforum_id));
            $st_topic_last_reply_title_print = strlen($st_topic_last_reply_title) > 50 ? substr($st_topic_last_reply_title, 0, 53) . '&hellip;' : $st_topic_last_reply_title;
            $output .= "<a href='" . bbp_get_forum_last_topic_permalink($subforum_id) . "'>" . $st_topic_last_reply_title_print . "</a>";
            $output .= "</div>";
            $output .= "<div class='last-posted-topic-time'>";
            $output .= bbp_get_forum_last_active_time($subforum_id);
        }
        $output .= "</div>";
    } else {
        // forum category display (no sub forums list)
        $st_forum_topic_count = bbp_get_forum_topic_count();
        if ($st_forum_topic_count == 0) {
            $output = "<div class='last-posted-topic-title no-topics'>";
            $output .= "No Topics";
        } else {
            $output = "<div class='last-posted-topic-title'>";
            // Get and crop title lenth if needed
            $st_topic_last_reply_title = bbp_get_topic_last_reply_title(bbp_get_forum_last_active_id($subforum_id));
            $st_topic_last_reply_title_print = strlen($st_topic_last_reply_title) > 50 ? substr($st_topic_last_reply_title, 0, 53) . '&hellip;' : $st_topic_last_reply_title;
            $output .= "<a href='" . bbp_get_forum_last_topic_permalink() . "'>" . $st_topic_last_reply_title_print . "</a>";
            $output .= "</div>";
            $output .= "<div class='last-posted-topic-time'>";
            $output .= bbp_get_forum_last_active_time();
        }
        $output .= "</div>";
    }
    return $output;
}
Esempio n. 5
0
 public function epicwebs_get_last_poster_block($subforum_id = "")
 {
     if (!empty($subforum_id)) {
         // Main forum display with sub forums
         $output = "<div class='last-posted-topic-title'>";
         $output .= "<a href='" . bbp_get_forum_last_topic_permalink($subforum_id) . "'>" . bbp_get_topic_last_reply_title(bbp_get_forum_last_active_id($subforum_id)) . "</a>";
         $output .= "</div>";
         $output .= "<div class='last-posted-topic-user'>av ";
         $author_id = bbp_get_forum_last_reply_author_id($subforum_id);
         $output .= "<span class=\"bbp-author-avatar\">" . get_avatar($author_id, '14') . "&nbsp;</span>";
         $output .= bbp_get_user_profile_link($author_id);
         $output .= "</div>";
         $output .= "<div class='last-posted-topic-time'>";
         $output .= bbp_get_forum_last_active_time($subforum_id);
         $output .= "</div>";
     } else {
         // forum category display (no sub forums list)
         $output = "<div class='last-posted-topic-title'>";
         $output .= "<a href='" . bbp_get_forum_last_topic_permalink() . "'>" . bbp_get_topic_last_reply_title(bbp_get_forum_last_active_id()) . "</a>";
         $output .= "</div>";
         $output .= "<div class='last-posted-topic-user'>av ";
         $output .= "<span class=\"bbp-author-avatar\">" . get_avatar(bbp_get_forum_last_reply_author_id(), '14') . "&nbsp;</span>";
         $output .= bbp_get_user_profile_link(bbp_get_forum_last_reply_author_id());
         $output .= "</div>";
         $output .= "<div class='last-posted-topic-time'>";
         $output .= bbp_get_forum_last_active_time();
         $output .= "</div>";
     }
     return $output;
 }
Esempio n. 6
0
function firmasite_social_bbp_get_topic_freshness_link($topic_id = 0)
{
    $topic_id = bbp_get_topic_id($topic_id);
    $link_url = bbp_get_topic_last_reply_url($topic_id);
    $title = bbp_get_topic_last_reply_title($topic_id);
    $time_since = bbp_get_topic_last_active_time($topic_id);
    if (!empty($time_since)) {
        $anchor = '<a href="' . $link_url . '" data-toggle="popover" data-rel="popover" data-placement="left" data-trigger="hover" data-html="true" data-original-title="' . __('Freshness', 'firmasite') . '" data-content="' . esc_attr($time_since) . '"><i class="icon-time"></i></a>';
    } else {
        $anchor = __('No Replies', 'firmasite');
    }
    return apply_filters('bbp_get_topic_freshness_link', $anchor, $topic_id);
}