コード例 #1
0
/**
 * Returns a user's post count (topics + replies).
 *
 * @since  1.0.0
 * @access public
 * @param  int     $user_id
 * @return int
 */
function mb_get_user_post_count($user_id = 0)
{
    $user_id = mb_get_user_id($user_id);
    $topic_count = mb_get_user_topic_count($user_id);
    $reply_count = mb_get_user_reply_count($user_id);
    $count = $topic_count + $reply_count;
    return apply_filters('mb_get_user_post_count', $count, $user_id);
}
コード例 #2
0
ファイル: users.php プロジェクト: justintadlock/message-board
 /**
  * Handles the output for custom columns.
  *
  * @since  1.0.0
  * @access public
  * @param  string  $column
  * @param  string  $column_name
  * @param  int     $post_id
  */
 public function custom_column($column, $column_name, $user_id)
 {
     /* Post status column. */
     if ('topics' === $column_name) {
         $user_id = mb_get_user_id($user_id);
         $topic_count = mb_get_user_topic_count($user_id);
         /* If the current user can create topics, link the topic count back to the edit topics screen. */
         if (!empty($topic_count) && current_user_can('create_topics')) {
             $url = add_query_arg(array('post_type' => mb_get_topic_post_type(), 'author' => $user_id), admin_url('edit.php'));
             $column = sprintf('<a href="%s" title="%s">%s</a>', esc_url($url), __('View topics by this user', 'message-board'), $topic_count);
             /* Else, display the count. */
         } else {
             $column = !empty($topic_count) ? $topic_count : number_format_i18n(0);
         }
         /* Replies column. */
     } elseif ('replies' === $column_name) {
         $user_id = mb_get_user_id($user_id);
         $reply_count = mb_get_user_reply_count($user_id);
         /* If the current user can create replies, link the topic count back to the edit replies screen. */
         if (!empty($reply_count) && current_user_can('create_replies')) {
             $url = add_query_arg(array('post_type' => mb_get_reply_post_type(), 'author' => $user_id), admin_url('edit.php'));
             $column = sprintf('<a href="%s" title="%s">%s</a>', esc_url($url), __('View replies by this user', 'message-board'), $reply_count);
             /* Else, display the count. */
         } else {
             $column = !empty($reply_count) ? $reply_count : number_format_i18n(0);
         }
     }
     /* Return the filtered column. */
     return $column;
 }
コード例 #3
0
		<ul>
			<li><?php 
    printf(__('Forum role: %s', 'message-board'), mb_get_role_link(mb_get_user_role()));
    ?>
</li>
			<li><?php 
    printf(__('Forums created: %s', 'message-board'), mb_get_user_forum_count());
    ?>
</li>
			<li><?php 
    printf(__('Topics started: %s', 'message-board'), mb_get_user_topic_count());
    ?>
</li>
			<li><?php 
    printf(__('Replies posted: %s', 'message-board'), mb_get_user_reply_count());
    ?>
</li>
			<li><?php 
    printf(__('Member since: %s', 'message-board'), date(get_option('date_format'), strtotime(get_the_author_meta('user_registered', get_query_var('author')))));
    ?>
</li>
			<li><?php 
    printf(__('Web site: %s', 'message-board'), make_clickable(get_the_author_meta('url', get_query_var('author'))));
    ?>
</li>
		</ul>

		<?php 
    echo wpautop(get_the_author_meta('description', get_query_var('author')));
    ?>
コード例 #4
0
    echo esc_url(get_the_author_meta('url'), mb_get_reply_author_id());
    ?>
"><?php 
    _e('Web Site', 'message-board');
    ?>
</a>
				<?php 
}
?>
				<br />
				<span class="mb-user-topic-count"><?php 
printf(__('Topics: %s', 'message-board'), mb_get_user_topic_count(mb_get_reply_author_id()));
?>
</span>
				<br />
				<span class="mb-user-reply-count"><?php 
printf(__('Replies: %s', 'message-board'), mb_get_user_reply_count(mb_get_reply_author_id()));
?>
</span>
			</div><!-- .mb-author-info -->

		</div><!-- .mb-author-box -->

		<div class="mb-reply-content">
			<?php 
mb_reply_content();
?>
		</div><!-- .mb-reply-content -->

	</article>
</li>