Exemple #1
0
/**
 * Return the author link of the reply
 *
 * @since bbPress (r2717)
 *
 * @param mixed $args Optional. If an integer, it is used as reply id.
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_is_reply_anonymous() To check if the reply is by an
 *                                 anonymous user
 * @uses bbp_get_reply_author_url() To get the reply author url
 * @uses bbp_get_reply_author_avatar() To get the reply author avatar
 * @uses bbp_get_reply_author_display_name() To get the reply author display
 *                                      name
 * @uses bbp_get_user_display_role() To get the reply author display role
 * @uses bbp_get_reply_author_id() To get the reply author id
 * @uses apply_filters() Calls 'bbp_get_reply_author_link' with the
 *                        author link and args
 * @return string Author link of reply
 */
function bbp_get_reply_author_link($args = '')
{
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('post_id' => 0, 'link_title' => '', 'type' => 'both', 'size' => 80, 'sep' => ' ', 'show_role' => false), 'get_reply_author_link');
    // Used as reply_id
    if (is_numeric($args)) {
        $reply_id = bbp_get_reply_id($args);
    } else {
        $reply_id = bbp_get_reply_id($r['post_id']);
    }
    // Reply ID is good
    if (!empty($reply_id)) {
        // Get some useful reply information
        $author_url = bbp_get_reply_author_url($reply_id);
        $anonymous = bbp_is_reply_anonymous($reply_id);
        // Tweak link title if empty
        if (empty($r['link_title'])) {
            $link_title = sprintf(empty($anonymous) ? __('View %s\'s profile', 'bbpress') : __('Visit %s\'s website', 'bbpress'), bbp_get_reply_author_display_name($reply_id));
            // Use what was passed if not
        } else {
            $link_title = $r['link_title'];
        }
        // Setup title and author_links array
        $link_title = !empty($link_title) ? ' title="' . esc_attr($link_title) . '"' : '';
        $author_links = array();
        // Get avatar
        if ('avatar' === $r['type'] || 'both' === $r['type']) {
            $author_links['avatar'] = bbp_get_reply_author_avatar($reply_id, $r['size']);
        }
        // Get display name
        if ('name' === $r['type'] || 'both' === $r['type']) {
            $author_links['name'] = bbp_get_reply_author_display_name($reply_id);
        }
        // Link class
        $link_class = ' class="bbp-author-' . esc_attr($r['type']) . '"';
        // Add links if not anonymous and existing user
        if (empty($anonymous) && bbp_user_has_profile(bbp_get_reply_author_id($reply_id))) {
            // Assemble the links
            foreach ($author_links as $link => $link_text) {
                $link_class = ' class="bbp-author-' . $link . '"';
                $author_link[] = sprintf('<a href="%1$s"%2$s%3$s>%4$s</a>', esc_url($author_url), $link_title, $link_class, $link_text);
            }
            if (true === $r['show_role']) {
                $author_link[] = bbp_get_reply_author_role(array('reply_id' => $reply_id));
            }
            $author_link = implode($r['sep'], $author_link);
            // No links if anonymous
        } else {
            $author_link = implode($r['sep'], $author_links);
        }
        // No replies so link is empty
    } else {
        $author_link = '';
    }
    return apply_filters('bbp_get_reply_author_link', $author_link, $r);
}
  <li class="bbp-topic-voice-count"><?php 
bbp_topic_voice_count();
?>
</li>

  <li class="bbp-topic-reply-count"><?php 
bbp_show_lead_topic() ? bbp_topic_reply_count() : bbp_topic_post_count();
?>
</li>

  <li class="bbp-topic-freshness">

    <div class="author-avatar">
      <?php 
$last_reply_avatar = bbp_get_reply_author_avatar(bbp_get_forum_last_reply_id(bbp_get_topic_last_active_id()), 50);
if ($last_reply_avatar != '') {
    echo $last_reply_avatar;
} else {
    echo bbp_get_topic_author_avatar(bbp_get_topic_last_active_id(), 50);
}
?>
    </div>

    <div class="topic-desc">
      <?php 
do_action('bbp_theme_before_topic_freshness_author');
?>

      <span class="bbp-topic-freshness-author"><?php 
bbp_author_link(array('post_id' => bbp_get_topic_last_active_id(), 'size' => 14));
Exemple #3
0
/**
 * Return the author link of the reply
 *
 * @since bbPress (r2717)
 *
 * @param mixed $args Optional. If an integer, it is used as reply id.
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_is_reply_anonymous() To check if the reply is by an
 *                                 anonymous user
 * @uses bbp_get_reply_author() To get the reply author name
 * @uses bbp_get_reply_author_url() To get the reply author url
 * @uses bbp_get_reply_author_avatar() To get the reply author avatar
 * @uses bbp_get_reply_author_display_name() To get the reply author display
 *                                      name
 * @uses bbp_get_user_display_role() To get the reply author display role
 * @uses bbp_get_reply_author_id() To get the reply author id
 * @uses apply_filters() Calls 'bbp_get_reply_author_link' with the
 *                        author link and args
 * @return string Author link of reply
 */
function bbp_get_reply_author_link($args = '')
{
    $defaults = array('post_id' => 0, 'link_title' => '', 'type' => 'both', 'size' => 80, 'sep' => '&nbsp;', 'show_role' => false);
    $r = bbp_parse_args($args, $defaults, 'get_reply_author_link');
    extract($r);
    // Used as reply_id
    if (is_numeric($args)) {
        $reply_id = bbp_get_reply_id($args);
    } else {
        $reply_id = bbp_get_reply_id($post_id);
    }
    if (!empty($reply_id)) {
        if (empty($link_title)) {
            $link_title = sprintf(!bbp_is_reply_anonymous($reply_id) ? __('View %s\'s profile', 'bbpress') : __('Visit %s\'s website', 'bbpress'), bbp_get_reply_author_display_name($reply_id));
        }
        $link_title = !empty($link_title) ? ' title="' . $link_title . '"' : '';
        $author_url = bbp_get_reply_author_url($reply_id);
        $anonymous = bbp_is_reply_anonymous($reply_id);
        // Get avatar
        if ('avatar' == $type || 'both' == $type) {
            $author_links['avatar'] = bbp_get_reply_author_avatar($reply_id, $size);
        }
        // Get display name
        if ('name' == $type || 'both' == $type) {
            $author_links['name'] = bbp_get_reply_author_display_name($reply_id);
        }
        // Add links if not anonymous
        if (empty($anonymous) && bbp_user_has_profile(bbp_get_reply_author_id($reply_id))) {
            foreach ($author_links as $link => $link_text) {
                $link_class = ' class="bbp-author-' . $link . '"';
                $author_link[] = sprintf('<a href="%1$s"%2$s%3$s>%4$s</a>', $author_url, $link_title, $link_class, $link_text);
            }
            if (true === $show_role) {
                $author_link[] = bbp_get_reply_author_role(array('reply_id' => $reply_id));
            }
            $author_link = join($sep, $author_link);
            // No links if anonymous
        } else {
            $author_link = join($sep, $author_links);
        }
        // No replies so link is empty
    } else {
        $author_link = '';
    }
    return apply_filters('bbp_get_reply_author_link', $author_link, $args);
}
Exemple #4
0
            </a></span>
          </li>

          <li class="bbp-forum-topic-count"><?php 
                echo bbp_get_forum_topic_count($sub_forum->ID);
                ?>
</li>
          <li class="bbp-forum-reply-count"><?php 
                echo bbp_get_forum_reply_count($sub_forum->ID);
                ?>
</li>
          <li class="bbp-forum-freshness">

            <div class="author-avatar">
              <?php 
                $last_reply_avatar = bbp_get_reply_author_avatar(bbp_get_forum_last_reply_id($sub_forum->ID), 50);
                if ($last_reply_avatar != '') {
                    echo $last_reply_avatar;
                } else {
                    echo bbp_get_topic_author_avatar($sub_forum->ID, 50);
                }
                ?>
            </div>

            <div class="topic-desc">
              <?php 
                do_action('bbp_theme_before_topic_freshness_author');
                ?>


              <span class="bbp-topic-freshness-author"><?php