本文整理汇总了PHP中bbp_get_user_topic_count_raw函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_user_topic_count_raw函数的具体用法?PHP bbp_get_user_topic_count_raw怎么用?PHP bbp_get_user_topic_count_raw使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_get_user_topic_count_raw函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
//.........这里部分代码省略.........
?>
</a>
<?php
bbp_logout_link();
?>
</div>
<div class="clearfix"></div>
<div class="list-group">
<a href="<?php
bbp_user_profile_url(bbp_get_current_user_id());
?>
" class="list-group-item bbp-user-forum-role <?php
if (bbp_is_user_home() && bbp_is_single_user_profile()) {
echo 'active';
}
?>
">
<span class="glyphicon ipt-icomoon-user4"></span> <?php
printf(__('%s Forum Role', 'ipt_kb'), '<span class="badge">' . bbp_get_user_display_role(bbp_get_current_user_id()) . '</span>');
?>
</a>
<a href="<?php
bbp_user_topics_created_url(bbp_get_current_user_id());
?>
" class="list-group-item bbp-user-topic-count <?php
if (bbp_is_user_home() && bbp_is_single_user_topics()) {
echo 'active';
}
?>
">
<span class="glyphicon ipt-icomoon-bubbles4"></span> <?php
printf(__('%s Topics Started', 'ipt_kb'), '<span class="badge">' . bbp_get_user_topic_count_raw(bbp_get_current_user_id()) . '</span>');
?>
</a>
<a href="<?php
bbp_user_replies_created_url(bbp_get_current_user_id());
?>
" class="list-group-item bbp-user-reply-count <?php
if (bbp_is_user_home() && bbp_is_single_user_replies()) {
echo 'active';
}
?>
">
<span class="glyphicon ipt-icomoon-reply"></span> <?php
printf(__('%s Replies Created', 'ipt_kb'), '<span class="badge">' . bbp_get_user_reply_count_raw(bbp_get_current_user_id()) . '</span>');
?>
</a>
<?php
if (bbp_is_favorites_active()) {
?>
<a href="<?php
bbp_favorites_permalink(bbp_get_current_user_id());
?>
" class="list-group-item bbp-user-favorite-count <?php
if (bbp_is_user_home() && bbp_is_favorites()) {
echo 'active';
}
?>
" title="<?php
printf(esc_attr__("Your Favorites", 'ipt_kb'));
?>
">
<span class="glyphicon ipt-icomoon-heart"></span> <?php
printf(__('%s Favorites', 'ipt_kb'), '<span class="badge">' . count(bbp_get_user_favorites_topic_ids(bbp_get_current_user_id())) . '</span>');
示例2: test_bbp_get_user_topic_count_raw
/**
* @covers ::bbp_get_user_topic_count_raw
*/
public function test_bbp_get_user_topic_count_raw()
{
$u = $this->factory->user->create();
$t = $this->factory->topic->create_many(3, array('post_author' => $u));
$count = bbp_get_user_topic_count_raw($u);
$this->assertSame(3, $count);
$t = $this->factory->topic->create_many(3, array('post_author' => $u));
$count = bbp_get_user_topic_count_raw($u);
$this->assertSame(6, $count);
}
示例3: apoc_update_post_count
/**
* Update a user's total post count
* @version 1.0.0
*/
function apoc_update_post_count($user_id, $type = 'all')
{
// Only do this for registered users
if (0 == $user_id) {
return false;
}
// Get existing post count
$posts = get_user_meta($user_id, 'post_count', true);
// If the meta does not yet exist, do a full update
if (empty($posts)) {
$posts = array();
$type == 'all';
}
// Articles
if ('all' == $type || 'articles' == $type) {
$articles = get_user_article_count($user_id);
$posts['articles'] = $articles > 0 ? $articles : 0;
}
// Comments
if ('all' == $type || 'comments' == $type) {
$comments = get_user_comment_count($user_id);
$posts['comments'] = $comments > 0 ? $comments : 0;
}
// Forum topics and replies
if ('all' == $type || 'forums' == $type) {
$topics = bbp_get_user_topic_count_raw($user_id);
$posts['topics'] = $topics > 0 ? $topics : 0;
$replies = bbp_get_user_reply_count_raw($user_id);
$posts['replies'] = $replies > 0 ? $replies : 0;
}
// Compute the total
$posts['total'] = $posts['articles'] + $posts['topics'] + $posts['replies'] + $posts['comments'];
// Save it
update_user_meta($user_id, 'post_count', $posts);
}
示例4: bbp_user_profile_url
}
?>
<div class="list-group">
<a href="<?php
bbp_user_profile_url();
?>
" class="list-group-item active bbp-user-forum-role"><span class="glyphicon ipt-icon-user4"></span> <?php
printf(__('%s Forum Role', 'ipt_kb'), '<span class="badge">' . bbp_get_user_display_role() . '</span>');
?>
</a>
<a href="<?php
bbp_user_topics_created_url();
?>
" class="list-group-item bbp-user-topic-count"><span class="glyphicon ipt-icon-bubbles4"></span> <?php
printf(__('%s Topics Started:', 'ipt_kb'), '<span class="badge">' . bbp_get_user_topic_count_raw() . '</span>');
?>
</a>
<a href="<?php
bbp_user_replies_created_url();
?>
" class="list-group-item bbp-user-reply-count"><span class="glyphicon ipt-icon-reply"></span> <?php
printf(__('%s Replies Created', 'ipt_kb'), '<span class="badge">' . bbp_get_user_reply_count_raw() . '</span>');
?>
</a>
<?php
if (bbp_is_favorites_active()) {
?>
<a href="<?php
bbp_favorites_permalink();
?>
示例5: widget
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
//No EDD? Bail
if (!class_exists('Easy_Digital_Downloads')) {
return false;
}
//Not EDD admin? Bail
if (!current_user_can('view_shop_sensitive_data')) {
return false;
}
//Handle before_widget args
echo $args['before_widget'];
if (!empty($instance['title'])) {
echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
}
$user_id = get_the_author_meta('ID');
$user_data = get_userdata($user_id);
?>
<div class="box">
<?php
do_action('wi_bbp_sidebar');
?>
<h3><?php
echo get_the_author_meta('first_name') . ' ' . get_the_author_meta('last_name');
?>
</h3>
<p class="bbp-user-forum-role"><?php
printf('Forum Role: %s', bbp_get_user_display_role($user_id));
?>
</p>
<p class="bbp-user-topic-count"><?php
printf('Topics Started: %s', bbp_get_user_topic_count_raw($user_id));
?>
</p>
<p class="bbp-user-reply-count"><?php
printf('Replies Created: %s', bbp_get_user_reply_count_raw($user_id));
?>
</p>
<div class="wi_users_purchases">
<h3><?php
_e('User\'s Purchases:', 'wi_bbp');
?>
</h3>
<?php
$purchases = edd_get_users_purchases($user_data->user_email, 100, false, 'any');
if ($purchases) {
echo '<ul>';
foreach ($purchases as $purchase) {
echo '<li>';
echo '<strong><a href="' . admin_url('edit.php?post_type=download&page=give-payment-history&view=view-order-details&id=' . $purchase->ID) . '">#' . $purchase->ID . ' - ' . edd_get_payment_status($purchase, true) . '</a></strong><br/>';
$downloads = edd_get_payment_meta_downloads($purchase->ID);
foreach ($downloads as $download) {
echo get_the_title($download['id']) . ' - ' . date('F j, Y', strtotime($purchase->post_date)) . '<br/>';
}
//Check license key
if (function_exists('edd_software_licensing')) {
$licenses = edd_software_licensing()->get_licenses_of_purchase($purchase->ID);
if ($licenses) {
echo '<strong>' . __('Licenses:', 'edd') . '</strong><br/>';
foreach ($licenses as $license) {
$key = edd_software_licensing()->get_license_key($license->ID);
$download_id = edd_software_licensing()->get_download_by_license($key);
$title = get_the_title($download_id);
//output license URL
echo $title . ' - <a href="' . admin_url('edit.php?post_type=download&page=give-licenses&s=' . $key) . '">' . $key . '</a>';
echo ' - ' . edd_software_licensing()->get_license_status($license->ID);
echo '<br/>';
}
}
echo '<hr/>';
}
echo '</li>';
}
echo '</ul>';
} else {
echo '<p>' . __('This user has never purchased anything.', 'wi_bbp') . '</p>';
}
?>
</div>
</div>
<?php
//After widget args
echo $args['after_widget'];
return false;
}
示例6: bbp_displayed_user_field
<?php
if (bbp_get_displayed_user_field('description')) {
?>
<p class="bbp-user-description"><?php
bbp_displayed_user_field('description');
?>
</p>
<?php
}
?>
<p class="bbp-user-forum-role"><?php
printf(__('Forum Role: %s', 'firmasite'), bbp_get_user_display_role());
?>
</p>
<p class="bbp-user-topic-count"><?php
printf(__('Topics Started: %s', 'firmasite'), bbp_get_user_topic_count_raw());
?>
</p>
<p class="bbp-user-reply-count"><?php
printf(__('Replies Created: %s', 'firmasite'), bbp_get_user_reply_count_raw());
?>
</p>
</div>
</div><!-- #bbp-author-topics-started -->
<?php
do_action('bbp_template_after_user_profile');
示例7: bbp_bump_user_topic_count
/**
* Bump the topic count for a user by a certain amount.
*
* @since 2.6.0 bbPress (r5309)
*
* @param int $user_id
* @param int $difference
* @uses bbp_get_user_topic_count() To get the users current topic count
* @uses bbp_set_user_topic_count() To set the users new topic count
*/
function bbp_bump_user_topic_count($user_id = 0, $difference = 1)
{
// Bail if no bump
if (empty($difference)) {
return false;
}
// Validate user ID
$user_id = bbp_get_user_id($user_id);
if (empty($user_id)) {
return false;
}
// Check meta for count, or query directly if not found
$count = bbp_get_user_topic_count($user_id, true);
if (empty($count)) {
$count = bbp_get_user_topic_count_raw($user_id);
}
$difference = (int) $difference;
$user_topic_count = (int) ($count + $difference);
// Add them up and filter them
$new_count = (int) apply_filters('bbp_bump_user_topic_count', $user_topic_count, $user_id, $difference, $count);
return bbp_update_user_topic_count($user_id, $new_count);
}
示例8: add_author_post_date_count_ip
/**
* Add post date, author post count and author ip to the author element.
*/
public function add_author_post_date_count_ip()
{
?>
<div class="bbp-reply-post-date"><?php
bbp_reply_post_date(bbp_get_reply_id());
?>
</div>
<div class="bbps-post-count"><?php
printf(__('Post count: %s', 'Avada'), bbp_get_user_reply_count_raw(bbp_get_reply_author_id()) + bbp_get_user_topic_count_raw(bbp_get_reply_author_id()));
?>
</div>
<?php
if (bbp_is_user_keymaster()) {
?>
<?php
do_action('bbp_theme_before_topic_author_admin_details');
?>
<div class="bbp-reply-ip fusion-reply-id"><?php
bbp_author_ip(bbp_get_topic_id());
?>
</div>
<?php
do_action('bbp_theme_after_topic_author_admin_details');
?>
<?php
}
}
示例9: bbp_displayed_user_field
<?php
if (bbp_get_displayed_user_field('description')) {
?>
<p class="bbp-user-description"><?php
bbp_displayed_user_field('description');
?>
</p>
<?php
}
?>
<p class="bbp-user-forum-role"><?php
printf(esc_html__('Forum Role: %s', 'monsoon'), bbp_get_user_display_role());
?>
</p>
<p class="bbp-user-topic-count"><?php
printf(esc_html__('Topics Started: %s', 'monsoon'), bbp_get_user_topic_count_raw());
?>
</p>
<p class="bbp-user-reply-count"><?php
printf(esc_html__('Replies Created: %s', 'monsoon'), bbp_get_user_reply_count_raw());
?>
</p>
</div>
</div><!-- #bbp-author-topics-started -->
<?php
do_action('bbp_template_after_user_profile');
示例10: bbp_get_reply_author_id
<?php
/**
* Replies Loop - Single Reply
*
* @package bbPress
* @subpackage Theme
*/
$cb_current_user = bbp_get_reply_author_id();
$cb_bbp_total_post_count = bbp_get_user_reply_count_raw($cb_current_user) + bbp_get_user_topic_count_raw($cb_current_user);
?>
<div id="post-<?php
bbp_reply_id();
?>
" class="bbp-reply-header">
<div class="bbp-meta">
<span class="bbp-reply-post-date"><?php
bbp_reply_post_date();
?>
</span>
<?php
if (bbp_is_single_user_replies()) {
?>
<span class="bbp-header">
<?php
_e('in reply to: ', 'bbpress');
示例11: shortcode_handler
//.........这里部分代码省略.........
break;
case 'blog':
if (AA_is_wpmu()) {
$blog = get_active_blog_for_user($id);
if (!empty($blog->siteurl)) {
$link = $blog->siteurl;
}
}
break;
case 'bp_memberpage':
if (function_exists('bp_core_get_user_domain')) {
$link = bp_core_get_user_domain($id);
} elseif (function_exists('bp_core_get_userurl')) {
// BP versions < 1.1
$link = bp_core_get_userurl($id);
}
break;
case 'bbpress_memberpage':
if (function_exists('bbp_get_user_profile_url')) {
$link = bbp_get_user_profile_url($id);
}
if (empty($link) || $link == 'http://') {
$link = false;
}
break;
case 'last_post':
$recent = get_posts(array('author' => $id, 'orderby' => 'date', 'order' => 'desc', 'numberposts' => 1));
$link = get_permalink($recent[0]->ID);
break;
case 'last_post_filtered':
$recent = get_posts(array('author' => $id, 'orderby' => 'date', 'order' => 'desc', 'numberposts' => 1));
$link = get_permalink($recent[0]->ID);
break;
case 'last_post_all':
$last_post = get_most_recent_post_of_user($id);
$link = get_permalink($last_post['post_id']);
break;
}
if ($link) {
$hrefStart = '<a href="' . $link . '">';
}
}
if (!empty($atts['show_name'])) {
$name = '<br />' . get_the_author_meta('display_name', $id);
$extraClass .= ' with-name';
}
if (!empty($atts['show_email'])) {
$userEmail = get_the_author_meta('user_email', $id);
$email = "<div class='email'><a href='mailto:" . $userEmail . "''>" . $userEmail . "</a></div>";
if (empty($email)) {
$extraClass .= 'email-missing';
} else {
$extraClass .= ' with-email';
}
}
if (!empty($atts['show_postcount'])) {
$name .= ' (' . ($postcount = $this->userlist->get_user_postcount($id) . ')');
}
if (!empty($atts['show_bbpress_post_count'])) {
if (function_exists('bbp_get_user_topic_count_raw')) {
$BBPRESS_postcount = bbp_get_user_topic_count_raw($id) + bbp_get_user_reply_count_raw($id);
$name .= ' (' . ($postcount = $BBPRESS_postcount . ')');
}
}
if (!empty($atts['show_biography'])) {
$biography = get_the_author_meta('description', $id);
if (0 < $bio_length) {
$biography = $this->userlist->truncate_html(wpautop($biography, true), apply_filters('aa_user_bio_length', $bio_length));
} else {
$biography = wpautop($biography, true);
}
if (!empty($atts['show_name'])) {
$bio = '<div class="bio bio-length-' . $atts['max_bio_length'] . '">' . $biography . '</div>';
}
if (empty($bio)) {
$extraClass .= ' biography-missing';
} else {
$extraClass .= ' with-biography bio-length-' . $bio_length;
}
}
// show last_post?
if (isset($atts['show_last_post']) && strlen($atts['show_last_post']) > 0) {
$last_post = '<div class="last_post">' . $this->userlist->aa_get_last_post($id) . '</div>';
if (empty($last_post)) {
$extraClass .= ' last-post-missing';
} else {
$extraClass .= ' with-last-post';
}
}
}
}
$hrefend = '';
if (!empty($hrefStart)) {
$hrefend = '</a>';
}
if (!empty($style)) {
$style = ' style="' . $style . '"';
}
return '<div class="shortcode-show-avatar ' . $extraClass . '"' . $style . '>' . $hrefStart . $avatar . $name . $last_post . $hrefend . $bio . $email . '</div>' . $content;
}
示例12: wi_bbp_sidebar
/**
* Forum Sidebar
*
* @since 1.0.0
* @return void
*/
function wi_bbp_sidebar()
{
global $post;
$user_id = get_the_author_meta('ID');
$user_data = get_userdata($user_id);
?>
<div class="box">
<?php
do_action('wi_bbp_sidebar');
?>
<h3><?php
echo get_the_author_meta('first_name') . ' ' . get_the_author_meta('last_name');
?>
</h3>
<p class="bbp-user-forum-role"><?php
printf('Forum Role: %s', bbp_get_user_display_role($user_id));
?>
</p>
<p class="bbp-user-topic-count"><?php
printf('Topics Started: %s', bbp_get_user_topic_count_raw($user_id));
?>
</p>
<p class="bbp-user-reply-count"><?php
printf('Replies Created: %s', bbp_get_user_reply_count_raw($user_id));
?>
</p>
<div class="wi_users_purchases">
<h3><?php
_e('User\'s Purchases:', 'wi_bbp');
?>
</h3>
<?php
$purchases = edd_get_users_purchases($user_data->user_email, 100, false, 'any');
if ($purchases) {
echo '<ul>';
foreach ($purchases as $purchase) {
echo '<li>';
echo '<strong><a href="' . admin_url('edit.php?post_type=download&page=give-payment-history&view=view-order-details&id=' . $purchase->ID) . '">#' . $purchase->ID . ' - ' . edd_get_payment_status($purchase, true) . '</a></strong><br/>';
$downloads = edd_get_payment_meta_downloads($purchase->ID);
foreach ($downloads as $download) {
echo get_the_title($download['id']) . ' - ' . date('F j, Y', strtotime($purchase->post_date)) . '<br/>';
}
//Check license key
if (function_exists('edd_software_licensing')) {
$licenses = edd_software_licensing()->get_licenses_of_purchase($purchase->ID);
if ($licenses) {
echo '<strong>Licenses:</strong><br/>';
foreach ($licenses as $license) {
$key = edd_software_licensing()->get_license_key($license->ID);
echo '<a href="' . admin_url('edit.php?post_type=download&page=give-licenses&s=' . $key) . '">' . $key . '</a>';
echo ' - ' . edd_software_licensing()->get_license_status($license->ID);
echo '<br/>';
}
}
echo '<hr/>';
}
echo '</li>';
}
echo '</ul>';
} else {
echo '<p>This user has never purchased anything.</p>';
}
?>
</div>
</div>
<?php
}
示例13: _e
<dl>
<dt><?php
_e('Forum Role', 'omega-td');
?>
</dt>
<dd><?php
echo bbp_get_user_display_role();
?>
</dd>
<dt><?php
_e('Topics Started', 'omega-td');
?>
</dt>
<dd><?php
echo bbp_get_user_topic_count_raw();
?>
</dd>
<dt><?php
_e('Replies Created', 'omega-td');
?>
</dt>
<dd><?php
echo bbp_get_user_reply_count_raw();
?>
</dd>
</dl>
</div>
</div><!-- #bbp-author-topics-started -->
示例14: shortcode_handler
//.........这里部分代码省略.........
if (!is_numeric($id)) {
if (email_exists($id)) {
$id = email_exists($id);
} else {
$isUser = false;
}
}
if ($isUser) {
$all_meta_for_user = get_user_meta($id);
if (count($all_meta_for_user) == 0) {
$isUser = false;
}
}
if ($isUser) {
if (!empty($atts['user_link'])) {
switch ($atts['user_link']) {
case 'authorpage':
$link = get_author_posts_url($id);
break;
case 'website':
$link = get_the_author_meta('user_url', $id);
if (empty($link) || $link == 'http://') {
$link = false;
}
break;
case 'blog':
if (AA_is_wpmu()) {
$blog = get_active_blog_for_user($id);
if (!empty($blog->siteurl)) {
$link = $blog->siteurl;
}
}
break;
case 'bp_memberpage':
if (function_exists('bp_core_get_user_domain')) {
$link = bp_core_get_user_domain($id);
} elseif (function_exists('bp_core_get_userurl')) {
// BP versions < 1.1
$link = bp_core_get_userurl($id);
}
break;
case 'bbpress_memberpage':
if (function_exists('bbp_get_user_profile_url')) {
$link = bbp_get_user_profile_url($id);
}
if (empty($link) || $link == 'http://') {
$link = false;
}
break;
}
if ($link) {
$hrefStart = '<a href="' . $link . '">';
}
}
if (!empty($atts['show_name'])) {
$name = '<br />' . get_the_author_meta('display_name', $id);
$extraClass .= ' with-name';
}
if (!empty($atts['show_email'])) {
$userEmail = get_the_author_meta('user_email', $id);
$email = "<div class='email'><a href='mailto:" . $userEmail . "''>" . $userEmail . "</a></div>";
if (empty($email)) {
$extraClass .= 'email-missing';
} else {
$extraClass .= ' with-email';
}
}
if (!empty($atts['show_postcount'])) {
require_once 'UserList.class.php';
$this->userlist = new UserList();
$name .= ' (' . ($postcount = $this->userlist->get_user_postcount($id) . ')');
}
if (!empty($atts['show_bbpress_post_count'])) {
if (function_exists('bbp_get_user_topic_count_raw')) {
$BBPRESS_postcount = bbp_get_user_topic_count_raw($id) + bbp_get_user_reply_count_raw($id);
$name .= ' (' . ($postcount = $BBPRESS_postcount . ')');
}
}
if (!empty($atts['show_biography'])) {
$bio = get_the_author_meta('description', $id);
if (!empty($atts['show_name'])) {
$bio = '<div class="bio">' . $bio . '</div>';
}
if (empty($bio)) {
$extraClass .= 'biography-missing';
} else {
$extraClass .= ' with-biography';
}
}
}
}
$hrefend = '';
if (!empty($hrefStart)) {
$hrefend = '</a>';
}
if (!empty($style)) {
$style = ' style="' . $style . '"';
}
return '<div class="shortcode-show-avatar ' . $extraClass . '"' . $style . '>' . $hrefStart . $avatar . $name . $hrefend . $bio . $email . '</div>' . $content;
}
示例15: bbp_get_reply_id
<?php
/**
* Replies Loop - Single Reply
*
* @package bbPress
* @subpackage Theme
*/
$reply_id = bbp_get_reply_id();
$user_id = bbp_get_reply_author_id($reply_id);
$topic_count = bbp_get_user_topic_count_raw($user_id);
$reply_count = bbp_get_user_reply_count_raw($user_id);
$post_count = (int) $topic_count + $reply_count;
?>
<li id="post-<?php
bbp_reply_id();
?>
" <?php
bbp_reply_class(0, array('media'));
?>
>
<?php
do_action('bbp_theme_before_reply_author_details');
?>
<div class="bbp_author_details">
<?php
bbp_reply_author_link(array('sep' => '', 'size' => 92));