当前位置: 首页>>代码示例>>PHP>>正文


PHP bbp_get_author_link函数代码示例

本文整理汇总了PHP中bbp_get_author_link函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_author_link函数的具体用法?PHP bbp_get_author_link怎么用?PHP bbp_get_author_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bbp_get_author_link函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bbp_get_single_topic_description

/**
 * Return a fancy description of the current topic, including total topics,
 * total replies, and last activity.
 *
 * @since 2.0.0 bbPress (r2860)
 *
 * @param array $args This function supports these arguments:
 *  - topic_id: Topic id
 *  - before: Before the text
 *  - after: After the text
 *  - size: Size of the avatar
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_get_topic_voice_count() To get the topic voice count
 * @uses bbp_get_topic_reply_count() To get the topic reply count
 * @uses bbp_get_topic_freshness_link() To get the topic freshness link
 * @uses bbp_get_topic_last_active_id() To get the topic last active id
 * @uses bbp_get_reply_author_link() To get the reply author link
 * @uses apply_filters() Calls 'bbp_get_single_topic_description' with
 *                        the description and args
 * @return string Filtered topic description
 */
function bbp_get_single_topic_description($args = array())
{
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('topic_id' => 0, 'before' => '<div class="bbp-template-notice info"><ul><li class="bbp-topic-description">', 'after' => '</li></ul></div>', 'size' => 14), 'get_single_topic_description');
    // Validate topic_id
    $topic_id = bbp_get_topic_id($r['topic_id']);
    // Unhook the 'view all' query var adder
    remove_filter('bbp_get_topic_permalink', 'bbp_add_view_all');
    // Build the topic description
    $vc_int = bbp_get_topic_voice_count($topic_id, true);
    $voice_count = bbp_get_topic_voice_count($topic_id, false);
    $reply_count = bbp_get_topic_replies_link($topic_id);
    $time_since = bbp_get_topic_freshness_link($topic_id);
    // Singular/Plural
    $voice_count = sprintf(_n('%s voice', '%s voices', $vc_int, 'bbpress'), $voice_count);
    // Topic has replies
    $last_reply = bbp_get_topic_last_reply_id($topic_id);
    if (!empty($last_reply)) {
        $last_updated_by = bbp_get_author_link(array('post_id' => $last_reply, 'size' => $r['size']));
        $retstr = sprintf(esc_html__('This topic contains %1$s, has %2$s, and was last updated by %3$s %4$s.', 'bbpress'), $reply_count, $voice_count, $last_updated_by, $time_since);
        // Topic has no replies
    } elseif (!empty($voice_count) && !empty($reply_count)) {
        $retstr = sprintf(esc_html__('This topic contains %1$s and has %2$s.', 'bbpress'), $voice_count, $reply_count);
        // Topic has no replies and no voices
    } elseif (empty($voice_count) && empty($reply_count)) {
        $retstr = sprintf(esc_html__('This topic has no replies.', 'bbpress'), $voice_count, $reply_count);
    }
    // Add the 'view all' filter back
    add_filter('bbp_get_topic_permalink', 'bbp_add_view_all');
    // Combine the elements together
    $retstr = $r['before'] . $retstr . $r['after'];
    // Return filtered result
    return apply_filters('bbp_get_single_topic_description', $retstr, $r, $args);
}
开发者ID:joeyblake,项目名称:bbpress,代码行数:55,代码来源:template.php

示例2: ipt_kb_bbp_forum_freshness_in_list

    function ipt_kb_bbp_forum_freshness_in_list($forum_id = 0)
    {
        $author_link = bbp_get_author_link(array('post_id' => bbp_get_forum_last_active_id($forum_id), 'type' => 'name'));
        $freshness = bbp_get_author_link(array('post_id' => bbp_get_forum_last_active_id($forum_id), 'size' => 32, 'type' => 'avatar'));
        if (!empty($freshness)) {
            ?>
<span class="pull-left thumbnail">
	<?php 
            echo $freshness;
            ?>
</span>
<?php 
        }
        do_action('bbp_theme_before_forum_freshness_link');
        ?>
<ul class="list-unstyled ipt_kb_forum_freshness_meta">
	<li class="bbp-topic-freshness-link"><?php 
        bbp_forum_freshness_link($forum_id);
        ?>
</li>
	<li class="bbp-topic-freshness-author">
		<?php 
        do_action('bbp_theme_before_topic_author');
        ?>
		<?php 
        if (!empty($author_link)) {
            printf(__('by %s', 'ipt_kb'), $author_link);
        }
        ?>
		<?php 
        do_action('bbp_theme_after_topic_author');
        ?>
	</li>
</ul>
<?php 
        do_action('bbp_theme_after_forum_freshness_link');
        ?>
	<?php 
    }
开发者ID:kreapress,项目名称:ipt-knowledgebase-theme-wp,代码行数:39,代码来源:bbpress.php

示例3: bbp_get_reply_revision_log

/**
 * Return the formatted revision log of the reply
 *
 * @since bbPress (r2782)
 *
 * @param int $reply_id Optional. Reply id
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply_revisions() To get the reply revisions
 * @uses bbp_get_reply_raw_revision_log() To get the raw revision log
 * @uses bbp_get_reply_author_display_name() To get the reply author
 * @uses bbp_get_reply_author_link() To get the reply author link
 * @uses bbp_convert_date() To convert the date
 * @uses bbp_get_time_since() To get the time in since format
 * @uses apply_filters() Calls 'bbp_get_reply_revision_log' with the
 *                        log and reply id
 * @return string Revision log of the reply
 */
function bbp_get_reply_revision_log($reply_id = 0)
{
    // Create necessary variables
    $reply_id = bbp_get_reply_id($reply_id);
    // Show the topic reply log if this is a topic in a reply loop
    if (bbp_is_topic($reply_id)) {
        return bbp_get_topic_revision_log($reply_id);
    }
    // Get the reply revision log (out of post meta
    $revision_log = bbp_get_reply_raw_revision_log($reply_id);
    // Check reply and revision log exist
    if (empty($reply_id) || empty($revision_log) || !is_array($revision_log)) {
        return false;
    }
    // Get the actual revisions
    $revisions = bbp_get_reply_revisions($reply_id);
    if (empty($revisions)) {
        return false;
    }
    $r = "\n\n" . '<ul id="bbp-reply-revision-log-' . esc_attr($reply_id) . '" class="bbp-reply-revision-log">' . "\n\n";
    // Loop through revisions
    foreach ((array) $revisions as $revision) {
        if (empty($revision_log[$revision->ID])) {
            $author_id = $revision->post_author;
            $reason = '';
        } else {
            $author_id = $revision_log[$revision->ID]['author'];
            $reason = $revision_log[$revision->ID]['reason'];
        }
        $author = bbp_get_author_link(array('size' => 14, 'link_text' => bbp_get_reply_author_display_name($revision->ID), 'post_id' => $revision->ID));
        $since = bbp_get_time_since(bbp_convert_date($revision->post_modified));
        $r .= "\t" . '<li id="bbp-reply-revision-log-' . esc_attr($reply_id) . '-item-' . esc_attr($revision->ID) . '" class="bbp-reply-revision-log-item">' . "\n";
        if (!empty($reason)) {
            $r .= "\t\t" . sprintf(esc_html__('This reply was modified %1$s by %2$s. Reason: %3$s', 'bbpress'), esc_html($since), $author, esc_html($reason)) . "\n";
        } else {
            $r .= "\t\t" . sprintf(esc_html__('This reply was modified %1$s by %2$s.', 'bbpress'), esc_html($since), $author) . "\n";
        }
        $r .= "\t" . '</li>' . "\n";
    }
    $r .= "\n" . '</ul>' . "\n\n";
    return apply_filters('bbp_get_reply_revision_log', $r, $reply_id);
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:59,代码来源:template.php

示例4: bbp_author_link

/**
 * Output the author link of a post
 *
 * @since 2.0.0 bbPress (r2875)
 *
 * @param array $args Optional. If it is an integer, it is used as post id.
 * @uses bbp_get_author_link() To get the post author link
 */
function bbp_author_link($args = array())
{
    echo bbp_get_author_link($args);
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:12,代码来源:template.php

示例5: bbp_get_single_forum_description

/**
 * Return a fancy description of the current forum, including total
 * topics, total replies, and last activity.
 *
 * @since bbPress (r2860)
 *
 * @param mixed $args This function supports these arguments:
 *  - forum_id: Forum id
 *  - before: Before the text
 *  - after: After the text
 *  - size: Size of the avatar
 * @uses bbp_get_forum_id() To get the forum id
 * @uses bbp_get_forum_topic_count() To get the forum topic count
 * @uses bbp_get_forum_reply_count() To get the forum reply count
 * @uses bbp_get_forum_subforum_count() To get the forum subforum count
 * @uses bbp_get_forum_freshness_link() To get the forum freshness link
 * @uses bbp_get_forum_last_active_id() To get the forum last active id
 * @uses bbp_get_author_link() To get the author link
 * @uses add_filter() To add the 'view all' filter back
 * @uses apply_filters() Calls 'bbp_get_single_forum_description' with
 *                        the description and args
 * @return string Filtered forum description
 */
function bbp_get_single_forum_description($args = '')
{
    // Default arguments
    $defaults = array('forum_id' => 0, 'before' => '<div class="bbp-template-notice info"><p class="bbp-forum-description">', 'after' => '</p></div>', 'size' => 14, 'feed' => true);
    $r = bbp_parse_args($args, $defaults, 'get_single_forum_description');
    extract($r);
    // Validate forum_id
    $forum_id = bbp_get_forum_id($forum_id);
    // Unhook the 'view all' query var adder
    remove_filter('bbp_get_forum_permalink', 'bbp_add_view_all');
    // Get some forum data
    $topic_count = bbp_get_forum_topic_count($forum_id);
    $reply_count = bbp_get_forum_reply_count($forum_id);
    $last_active = bbp_get_forum_last_active_id($forum_id);
    // Has replies
    if (!empty($reply_count)) {
        $reply_text = sprintf(_n('%s reply', '%s replies', $reply_count, 'bbpress'), $reply_count);
    }
    // Forum has active data
    if (!empty($last_active)) {
        $topic_text = bbp_get_forum_topics_link($forum_id);
        $time_since = bbp_get_forum_freshness_link($forum_id);
        $last_updated_by = bbp_get_author_link(array('post_id' => $last_active, 'size' => $size));
        // Forum has no last active data
    } else {
        $topic_text = sprintf(_n('%s topic', '%s topics', $topic_count, 'bbpress'), $topic_count);
    }
    // Forum has active data
    if (!empty($last_active)) {
        if (!empty($reply_count)) {
            if (bbp_is_forum_category($forum_id)) {
                $retstr = sprintf(__('This category contains %1$s and %2$s, and was last updated by %3$s %4$s.', 'bbpress'), $topic_text, $reply_text, $last_updated_by, $time_since);
            } else {
                $retstr = sprintf(__('This forum contains %1$s and %2$s, and was last updated by %3$s %4$s.', 'bbpress'), $topic_text, $reply_text, $last_updated_by, $time_since);
            }
        } else {
            if (bbp_is_forum_category($forum_id)) {
                $retstr = sprintf(__('This category contains %1$s, and was last updated by %2$s %3$s.', 'bbpress'), $topic_text, $last_updated_by, $time_since);
            } else {
                $retstr = sprintf(__('This forum contains %1$s, and was last updated by %2$s %3$s.', 'bbpress'), $topic_text, $last_updated_by, $time_since);
            }
        }
        // Forum has no last active data
    } else {
        if (!empty($reply_count)) {
            if (bbp_is_forum_category($forum_id)) {
                $retstr = sprintf(__('This category contains %1$s and %2$s.', 'bbpress'), $topic_text, $reply_text);
            } else {
                $retstr = sprintf(__('This forum contains %1$s and %2$s.', 'bbpress'), $topic_text, $reply_text);
            }
        } else {
            if (!empty($topic_count)) {
                if (bbp_is_forum_category($forum_id)) {
                    $retstr = sprintf(__('This category contains %1$s.', 'bbpress'), $topic_text);
                } else {
                    $retstr = sprintf(__('This forum contains %1$s.', 'bbpress'), $topic_text);
                }
            } else {
                $retstr = __('This forum is empty.', 'bbpress');
            }
        }
    }
    // Add feeds
    //$feed_links = ( !empty( $feed ) ) ? bbp_get_forum_topics_feed_link ( $forum_id ) . bbp_get_forum_replies_feed_link( $forum_id ) : '';
    // Add the 'view all' filter back
    add_filter('bbp_get_forum_permalink', 'bbp_add_view_all');
    // Combine the elements together
    $retstr = $before . $retstr . $after;
    // Return filtered result
    return apply_filters('bbp_get_single_forum_description', $retstr, $args);
}
开发者ID:hscale,项目名称:webento,代码行数:94,代码来源:bbp-forum-template.php

示例6: test_bbp_get_author_link

 /**
  * @covers ::bbp_author_link
  * @covers ::bbp_get_author_link
  */
 public function test_bbp_get_author_link()
 {
     $t = $this->factory->topic->create();
     $display_name = $this->keymaster_userdata->display_name;
     $current_user = get_current_user_id();
     $size = 80;
     $wp_avatar = get_avatar($current_user, $size);
     // Pretty permalinks
     $this->set_permalink_structure('/%postname%/');
     $author_link = '<a href="http://' . WP_TESTS_DOMAIN . '/forums/users/' . $this->keymaster_userdata->user_nicename . '/" title="View ' . $display_name . '&#039;s profile" class="bbp-author-avatar" rel="nofollow">' . $wp_avatar . '</a>&nbsp;<a href="http://' . WP_TESTS_DOMAIN . '/forums/users/' . $this->keymaster_userdata->user_nicename . '/" title="View ' . $display_name . '&#039;s profile" class="bbp-author-name" rel="nofollow">' . $display_name . '</a>';
     // String.
     $this->assertSame($author_link, bbp_get_author_link($t));
     // Output.
     $this->expectOutputString($author_link);
     bbp_author_link($t);
     ob_clean();
     // Ugly permalinks
     $this->set_permalink_structure();
     $author_link = '<a href="http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '" title="View ' . $display_name . '&#039;s profile" class="bbp-author-avatar" rel="nofollow">' . $wp_avatar . '</a>&nbsp;<a href="http://' . WP_TESTS_DOMAIN . '/?bbp_user=' . $this->keymaster_id . '" title="View ' . $display_name . '&#039;s profile" class="bbp-author-name" rel="nofollow">' . $display_name . '</a>';
     // String.
     $this->assertSame($author_link, bbp_get_author_link($t));
     // Output.
     $this->expectOutputString($author_link);
     bbp_author_link($t);
 }
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:29,代码来源:user.php

示例7: _e

		<span><?php 
_e('Last post: ', 'framework');
?>
</span>
		<?php 
do_action('bbp_theme_after_topic_meta');
?>
			<?php 
do_action('bbp_theme_before_topic_freshness_author');
?>

			<span class="bbp-topic-freshness-author">
			<?php 
if (class_exists('userpro_api')) {
    global $userpro;
    $link = preg_replace("/(?<=href=(\"|'))[^\"']+(?=(\"|'))/", $userpro->permalink(bbp_get_topic_author_id(bbp_get_topic_last_active_id())), bbp_get_author_link(array('post_id' => bbp_get_topic_last_active_id(), 'size' => 30)));
} else {
    bbp_author_link(array('post_id' => bbp_get_topic_last_active_id(), 'type' => 'name'));
}
?>
			</span> - 

			<?php 
do_action('bbp_theme_after_topic_freshness_author');
?>

		<?php 
do_action('bbp_theme_before_topic_freshness_link');
?>

		<?php 
开发者ID:justinwool,项目名称:vortago,代码行数:31,代码来源:loop-single-topic.php

示例8: bbp_author_link

/**
 * Output the author link of a post
 *
 * @since bbPress (r2875)
 *
 * @param mixed $args Optional. If it is an integer, it is used as post id.
 * @uses bbp_get_author_link() To get the post author link
 */
function bbp_author_link($args = '')
{
    echo bbp_get_author_link($args);
}
开发者ID:rmccue,项目名称:bbPress,代码行数:12,代码来源:bbp-user-template.php

示例9: apoc_topic_byline

function apoc_topic_byline($args = '')
{
    // Default arguments
    $defaults = array('topic_id' => 0, 'before' => '<p class="post-byline">', 'after' => '</p>', 'size' => 50, 'echo' => true);
    $args = wp_parse_args($args, $defaults);
    // Validate topic_id
    $topic_id = bbp_get_topic_id($args['topic_id']);
    // Get the author avatar
    $avatar = apoc_get_avatar(array('user_id' => bbp_get_topic_author_id(), 'size' => $args['size']));
    // Build the topic description
    $voice_count = bbp_get_topic_voice_count($topic_id);
    $reply_count = bbp_get_topic_reply_count($topic_id, true) + 1;
    $time_since = bbp_get_topic_freshness_link($topic_id);
    $author = bbp_get_author_link(array('post_id' => $topic_id, 'type' => 'name'));
    // Singular/Plural
    $reply_count = sprintf(_n('%d posts', '%d posts', $reply_count), $reply_count);
    $voice_count = sprintf(_n('%s member', '%s members', $voice_count), $voice_count);
    // Topic has replies
    $last_reply = bbp_get_topic_last_active_id($topic_id);
    if (!empty($last_reply)) {
        $last_updated_by = bbp_get_author_link(array('post_id' => $last_reply, 'type' => 'name'));
        $retstr = sprintf('This topic by %1$s contains %2$s by %3$s, and was last updated by %4$s, %5$s.', $author, $reply_count, $voice_count, $last_updated_by, $time_since);
        // Topic has no replies
    } elseif (!empty($voice_count) && !empty($reply_count)) {
        $retstr = sprintf('This topic contains %1$s by %2$s.', $reply_count, $voice_count);
        // Topic has no replies and no voices
    } elseif (empty($voice_count) && empty($reply_count)) {
        $retstr = sprintf('This topic has no replies yet.');
    }
    // Combine the elements together
    $retstr = $args['before'] . $avatar . '<span>' . $retstr . '</span>' . $args['after'];
    // Return filtered result
    if (true == $args['echo']) {
        echo $retstr;
    } else {
        return $retstr;
    }
}
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:38,代码来源:bbpress.php

示例10: do_action

}
?>
			<?php 
do_action('bbp_theme_before_topic_freshness_link');
?>
			<ul class="list-unstyled ipt_kb_topic_freshness_meta">
				<li class="bbp-topic-freshness-link"><?php 
bbp_topic_freshness_link();
?>
</li>
				<li class="bbp-topic-freshness-author">
					<?php 
do_action('bbp_theme_before_topic_freshness_author');
?>
					<?php 
$author_link = bbp_get_author_link(array('post_id' => bbp_get_topic_last_active_id(), 'type' => 'name'));
?>
					<?php 
if (!empty($author_link)) {
    printf(__('by %s', 'ipt_kb'), $author_link);
}
?>
					<?php 
do_action('bbp_theme_after_topic_freshness_author');
?>
				</li>
			</ul>
			<?php 
do_action('bbp_theme_after_topic_freshness_link');
?>
		</li>
开发者ID:sleepystephen,项目名称:ipt-knowledgebase-theme-wp,代码行数:31,代码来源:loop-single-topic.php

示例11: td_show_forum

function td_show_forum($forum_object)
{
    $last_active = bbp_get_forum_last_active_id($forum_object->ID);
    $time_since = '';
    $last_updated_by_avatar = '';
    if (!empty($last_active)) {
        $time_since = bbp_get_forum_freshness_link($forum_object->ID);
        $last_updated_by_avatar = bbp_get_author_link(array('post_id' => $last_active, 'size' => 40, 'type' => 'avatar'));
        //echo $time_since;
    }
    ?>
    <div class="clearfix"></div>
    <ul class="td-forum-list-table td-forum-content">
        <li class="td-forum-category-title<?php 
    if (empty($forum_object->post_content)) {
        echo ' td-forum-title-no-desc';
    }
    ?>
">
            <div class="td-forum-index-padd">
                <a class="bbp-forum-title" href="<?php 
    bbp_forum_permalink($forum_object->ID);
    ?>
"><?php 
    bbp_forum_title($forum_object->ID);
    ?>
</a>
                <?php 
    if (!empty($forum_object->post_content)) {
        ?>
                    <div class="td-forum-description"><?php 
        echo $forum_object->post_content;
        ?>
</div>
                <?php 
    }
    ?>

                </li><li class="td-forum-replies">
                    <div><?php 
    echo bbp_get_forum_topic_count($forum_object->ID);
    ?>
 topics</div>
                    <div><?php 
    echo bbp_get_forum_reply_count($forum_object->ID);
    ?>
 replies</div>
                </li><li class="td-forum-last-comment">

                <div>
                    <?php 
    echo $last_updated_by_avatar;
    ?>
                </div>



                <div class="td-forum-last-comment-content">
                    <div class="td-forum-author-name">
                        by <a class="td-forum-last-author" href="<?php 
    bbp_reply_author_url($last_active);
    ?>
"><?php 
    echo bbp_get_topic_author_display_name($last_active);
    ?>
</a>
                    </div>
                    <div class="td-forum-time-comment">
                        <?php 
    bbp_forum_freshness_link($forum_object->ID);
    ?>
                    </div>
                </div>
        </li>
    </ul>
    <div class="clearfix"></div>
    <?php 
}
开发者ID:Vatia13,项目名称:wordpress,代码行数:78,代码来源:content-archive-forum.php

示例12: _e

_e('Posts', 'framework');
?>
</div>
	</li>


	<li class="bbp-forum-freshness">
		<p class="bbp-topic-meta">

			<?php 
if (class_exists('userpro_api')) {
    /* Integrating UserPro */
    global $userpro;
    $link = preg_replace("/(?<=href=(\"|'))[^\"']+(?=(\"|'))/", $userpro->permalink(bbp_get_topic_author_id(bbp_get_forum_last_active_id())), bbp_get_author_link(array('post_id' => bbp_get_forum_last_active_id(), 'size' => 47)));
} else {
    $link = bbp_get_author_link(array('post_id' => bbp_get_forum_last_active_id(), 'size' => 47));
}
?>
			<span class="bbp-topic-freshness-author"><?php 
echo $link;
?>
</span>

			<?php 
do_action('bbp_theme_after_topic_author');
?>

		</p>

		<?php 
do_action('bbp_theme_before_forum_freshness_link');
开发者ID:justinwool,项目名称:vortago,代码行数:31,代码来源:loop-single-forum.php


注:本文中的bbp_get_author_link函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。