/** * Return the author link of the topic * * @since 2.0.0 bbPress (r2717) * * @param mixed|int $args If it is an integer, it is used as topic id. * Optional. * @uses bbp_get_topic_id() To get the topic id * @uses bbp_get_topic_author_display_name() To get the topic author * @uses bbp_is_topic_anonymous() To check if the topic is by an * anonymous user * @uses bbp_get_topic_author_url() To get the topic author url * @uses bbp_get_topic_author_avatar() To get the topic author avatar * @uses bbp_get_topic_author_display_name() To get the topic author display * name * @uses bbp_get_user_display_role() To get the topic author display role * @uses bbp_get_topic_author_id() To get the topic author id * @uses apply_filters() Calls 'bbp_get_topic_author_link' with the link * and args * @return string Author link of topic */ function bbp_get_topic_author_link($args = array()) { // 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_topic_author_link'); // Used as topic_id if (is_numeric($args)) { $topic_id = bbp_get_topic_id($args); } else { $topic_id = bbp_get_topic_id($r['post_id']); } // Topic ID is good if (!empty($topic_id)) { // Get some useful topic information $author_url = bbp_get_topic_author_url($topic_id); $anonymous = bbp_is_topic_anonymous($topic_id); // Tweak link title if empty if (empty($r['link_title'])) { $title = empty($anonymous) ? __('View %s\'s profile', 'bbpress') : __('Visit %s\'s website', 'bbpress'); $author = bbp_get_topic_author_display_name($topic_id); $link_title = sprintf($title, $author); // 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_topic_author_avatar($topic_id, $r['size']); } // Get display name if ('name' === $r['type'] || 'both' === $r['type']) { $author_links['name'] = bbp_get_topic_author_display_name($topic_id); } // Link class $link_class = ' class="bbp-author-' . esc_attr($r['type']) . '"'; // Add links if not anonymous if (empty($anonymous) && bbp_user_has_profile(bbp_get_topic_author_id($topic_id))) { // Assemble the links foreach ($author_links as $link => $link_text) { $link_class = ' class="bbp-author-' . esc_attr($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_topic_author_role(array('topic_id' => $topic_id)); } $author_link = implode($r['sep'], $author_link); // No links if anonymous } else { $author_link = implode($r['sep'], $author_links); } } else { $author_link = ''; } return apply_filters('bbp_get_topic_author_link', $author_link, $args); }
?> "></div> <ul id="bbp-topic-<?php bbp_topic_id(); ?> " <?php bbp_topic_class(); ?> > <li class="col-md-1"> <?php do_action('bbp_theme_before_topic_started_by'); ?> <span class="bbp-topic-started-by-avatar-avatar"><?php echo bbp_get_topic_author_avatar(); ?> </span> <?php do_action('bbp_theme_after_topic_started_by'); ?> </li> <li class="bbp-topic-title col-md-5"> <?php if (bbp_is_user_home()) { ?> <?php if (bbp_is_favorites()) { ?> <span class="bbp-topic-action">
* * @package bbPress * @subpackage Theme */ ?> <ul id="bbp-topic-<?php bbp_topic_id(); ?> " <?php bbp_topic_class(); ?> > <li class="topic-avatars"> <?php echo bbp_get_topic_author_avatar(0, 65); ?> </li> <li class="topic-meta"> <?php if (bbp_is_user_home()) { ?> <?php if (bbp_is_favorites()) { ?> <span class="bbp-row-actions">
/** * Return the author link of the topic * * @since bbPress (r2717) * * @param mixed|int $args If it is an integer, it is used as topic id. * Optional. * @uses bbp_get_topic_id() To get the topic id * @uses bbp_get_topic_author_display_name() To get the topic author * @uses bbp_is_topic_anonymous() To check if the topic is by an * anonymous user * @uses bbp_get_topic_author_url() To get the topic author url * @uses bbp_get_topic_author_avatar() To get the topic author avatar * @uses bbp_get_topic_author_display_name() To get the topic author display * name * @uses bbp_get_user_display_role() To get the topic author display role * @uses bbp_get_topic_author_id() To get the topic author id * @uses apply_filters() Calls 'bbp_get_topic_author_link' with the link * and args * @return string Author link of topic */ function bbp_get_topic_author_link($args = '') { $defaults = array('post_id' => 0, 'link_title' => '', 'type' => 'both', 'size' => 80, 'sep' => ' ', 'show_role' => false); $r = bbp_parse_args($args, $defaults, 'get_topic_author_link'); extract($r); // Used as topic_id if (is_numeric($args)) { $topic_id = bbp_get_topic_id($args); } else { $topic_id = bbp_get_topic_id($post_id); } // Topic ID is good if (!empty($topic_id)) { // Tweak link title if empty if (empty($link_title)) { $link_title = sprintf(!bbp_is_topic_anonymous($topic_id) ? __('View %s\'s profile', 'bbpress') : __('Visit %s\'s website', 'bbpress'), bbp_get_topic_author_display_name($topic_id)); } $link_title = !empty($link_title) ? ' title="' . $link_title . '"' : ''; $author_url = bbp_get_topic_author_url($topic_id); $anonymous = bbp_is_topic_anonymous($topic_id); $author_links = array(); // Get avatar if ('avatar' == $type || 'both' == $type) { $author_links['avatar'] = bbp_get_topic_author_avatar($topic_id, $size); } // Get display name if ('name' == $type || 'both' == $type) { $author_links['name'] = bbp_get_topic_author_display_name($topic_id); } // Link class $link_class = ' class="bbp-author-' . $type . '"'; // Add links if not anonymous if (empty($anonymous)) { // 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>', $author_url, $link_title, $link_class, $link_text); } if (true === $show_role) { $author_link[] = bbp_get_topic_author_role(array('topic_id' => $topic_id)); } $author_link = join($sep, $author_link); // No links if anonymous } else { $author_link = join($sep, $author_links); } } else { $author_link = ''; } return apply_filters('bbp_get_topic_author_link', $author_link, $args); }
</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)); ?> </span> <?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 $last_reply_link = bbp_get_reply_author_link(bbp_get_forum_last_reply_id($sub_forum->ID), 50); if ($last_reply_link != '') { echo $last_reply_link; } else {