<?php /** * Template Name: bbPress - Statistics * * @package bbPress * @subpackage Theme */ // Get the statistics and extract them for later use in this template // @todo - remove variable references extract(bbp_get_statistics(), EXTR_SKIP); get_header(); st_before_content($columns); do_action('bbp_template_notices'); while (have_posts()) { the_post(); ?> <div id="bbp-statistics" class="bbp-statistics"> <h1 class="entry-title"><?php the_title(); ?> </h1> <div class="entry-content"> <?php get_the_content() ? the_content() : _e('<p>Here are the statistics and popular topics of our forums.</p>', 'bbpress'); ?> <dl role="main">
<?php /** * Statistics Content Part * * @package bbPress * @subpackage Theme */ // Get the statistics $stats = bbp_get_statistics(); ?> <dl role="main"> <?php do_action('bbp_before_statistics'); ?> <dt><?php _e('Registered Users', 'bbpress'); ?> </dt> <dd> <strong><?php echo esc_html($stats['user_count']); ?> </strong> </dd> <dt><?php _e('Forums', 'bbpress');
function g1_bbp_reply_count($value) { if ('bbp_reply_count' === $value) { $value = bbp_get_statistics(array('count_users' => !true, 'count_forums' => !true, 'count_topics' => !true, 'count_private_topics' => !true, 'count_spammed_topics' => !true, 'count_trashed_topics' => !true, 'count_replies' => true, 'count_private_replies' => !true, 'count_spammed_replies' => !true, 'count_trashed_replies' => !true, 'count_tags' => !true, 'count_empty_tags' => !true)); $value = $value['reply_count']; } return $value; }
/** * bbPress Dashboard Right Now Widget * * Adds a dashboard widget with forum statistics * * @since 2.0.0 bbPress (r2770) * * @deprecated 2.6.0 bbPress (r5268) * * @uses bbp_get_version() To get the current bbPress version * @uses bbp_get_statistics() To get the forum statistics * @uses current_user_can() To check if the user is capable of doing things * @uses bbp_get_forum_post_type() To get the forum post type * @uses bbp_get_topic_post_type() To get the topic post type * @uses bbp_get_reply_post_type() To get the reply post type * @uses get_admin_url() To get the administration url * @uses add_query_arg() To add custom args to the url * @uses do_action() Calls 'bbp_dashboard_widget_right_now_content_table_end' * below the content table * @uses do_action() Calls 'bbp_dashboard_widget_right_now_table_end' * below the discussion table * @uses do_action() Calls 'bbp_dashboard_widget_right_now_discussion_table_end' * below the discussion table * @uses do_action() Calls 'bbp_dashboard_widget_right_now_end' below the widget */ function bbp_dashboard_widget_right_now() { // Get the statistics $r = bbp_get_statistics(); ?> <div class="table table_content"> <p class="sub"><?php esc_html_e('Discussion', 'bbpress'); ?> </p> <table> <tr class="first"> <?php $num = $r['forum_count']; $text = _n('Forum', 'Forums', $r['forum_count'], 'bbpress'); if (current_user_can('publish_forums')) { $link = add_query_arg(array('post_type' => bbp_get_forum_post_type()), get_admin_url(null, 'edit.php')); $num = '<a href="' . esc_url($link) . '">' . $num . '</a>'; $text = '<a href="' . esc_url($link) . '">' . $text . '</a>'; } ?> <td class="first b b-forums"><?php echo $num; ?> </td> <td class="t forums"><?php echo $text; ?> </td> </tr> <tr> <?php $num = $r['topic_count']; $text = _n('Topic', 'Topics', $r['topic_count'], 'bbpress'); if (current_user_can('publish_topics')) { $link = add_query_arg(array('post_type' => bbp_get_topic_post_type()), get_admin_url(null, 'edit.php')); $num = '<a href="' . esc_url($link) . '">' . $num . '</a>'; $text = '<a href="' . esc_url($link) . '">' . $text . '</a>'; } ?> <td class="first b b-topics"><?php echo $num; ?> </td> <td class="t topics"><?php echo $text; ?> </td> </tr> <tr> <?php $num = $r['reply_count']; $text = _n('Reply', 'Replies', $r['reply_count'], 'bbpress'); if (current_user_can('publish_replies')) { $link = add_query_arg(array('post_type' => bbp_get_reply_post_type()), get_admin_url(null, 'edit.php')); $num = '<a href="' . esc_url($link) . '">' . $num . '</a>'; $text = '<a href="' . esc_url($link) . '">' . $text . '</a>'; } ?> <td class="first b b-replies"><?php echo $num; ?> </td> <td class="t replies"><?php echo $text; ?> </td> </tr> <?php if (bbp_allow_topic_tags()) { ?> <tr> <?php $num = $r['topic_tag_count']; $text = _n('Topic Tag', 'Topic Tags', $r['topic_tag_count'], 'bbpress'); if (current_user_can('manage_topic_tags')) { $link = add_query_arg(array('taxonomy' => bbp_get_topic_tag_tax_id(), 'post_type' => bbp_get_topic_post_type()), get_admin_url(null, 'edit-tags.php')); $num = '<a href="' . esc_url($link) . '">' . $num . '</a>'; $text = '<a href="' . esc_url($link) . '">' . $text . '</a>'; } ?> <td class="first b b-topic_tags"><span class="total-count"><?php echo $num; ?> </span></td> <td class="t topic_tags"><?php echo $text; ?> </td> </tr> <?php } ?> <?php do_action('bbp_dashboard_widget_right_now_content_table_end'); ?> </table> </div> <div class="table table_discussion"> <p class="sub"><?php esc_html_e('Users & Moderation', 'bbpress'); ?> </p> <table> <tr class="first"> <?php $num = $r['user_count']; $text = _n('User', 'Users', $r['user_count'], 'bbpress'); if (current_user_can('edit_users')) { $link = get_admin_url(null, 'users.php'); $num = '<a href="' . $link . '">' . $num . '</a>'; $text = '<a href="' . $link . '">' . $text . '</a>'; } ?> <td class="b b-users"><span class="total-count"><?php echo $num; ?> </span></td> <td class="last t users"><?php echo $text; ?> </td> </tr> <?php if (isset($r['topic_count_hidden'])) { ?> <tr> <?php $num = $r['topic_count_hidden']; $text = _n('Hidden Topic', 'Hidden Topics', $r['topic_count_hidden'], 'bbpress'); $link = add_query_arg(array('post_type' => bbp_get_topic_post_type()), get_admin_url(null, 'edit.php')); if ('0' !== $num) { $link = add_query_arg(array('post_status' => bbp_get_spam_status_id()), $link); } $num = '<a href="' . esc_url($link) . '" title="' . esc_attr($r['hidden_topic_title']) . '">' . $num . '</a>'; $text = '<a class="waiting" href="' . esc_url($link) . '" title="' . esc_attr($r['hidden_topic_title']) . '">' . $text . '</a>'; ?> <td class="b b-hidden-topics"><?php echo $num; ?> </td> <td class="last t hidden-replies"><?php echo $text; ?> </td> </tr> <?php } ?> <?php if (isset($r['reply_count_hidden'])) { ?> <tr> <?php $num = $r['reply_count_hidden']; $text = _n('Hidden Reply', 'Hidden Replies', $r['reply_count_hidden'], 'bbpress'); $link = add_query_arg(array('post_type' => bbp_get_reply_post_type()), get_admin_url(null, 'edit.php')); if ('0' !== $num) { $link = add_query_arg(array('post_status' => bbp_get_spam_status_id()), $link); } $num = '<a href="' . esc_url($link) . '" title="' . esc_attr($r['hidden_reply_title']) . '">' . $num . '</a>'; $text = '<a class="waiting" href="' . esc_url($link) . '" title="' . esc_attr($r['hidden_reply_title']) . '">' . $text . '</a>'; ?> <td class="b b-hidden-replies"><?php echo $num; ?> </td> <td class="last t hidden-replies"><?php echo $text; ?> </td> </tr> <?php } ?> <?php if (bbp_allow_topic_tags() && isset($r['empty_topic_tag_count'])) { ?> <tr> <?php $num = $r['empty_topic_tag_count']; $text = _n('Empty Topic Tag', 'Empty Topic Tags', $r['empty_topic_tag_count'], 'bbpress'); $link = add_query_arg(array('taxonomy' => bbp_get_topic_tag_tax_id(), 'post_type' => bbp_get_topic_post_type()), get_admin_url(null, 'edit-tags.php')); $num = '<a href="' . esc_url($link) . '">' . $num . '</a>'; $text = '<a class="waiting" href="' . esc_url($link) . '">' . $text . '</a>'; ?> <td class="b b-hidden-topic-tags"><?php echo $num; ?> </td> <td class="last t hidden-topic-tags"><?php echo $text; ?> </td> </tr> <?php } ?> <?php do_action('bbp_dashboard_widget_right_now_discussion_table_end'); ?> </table> </div> <?php do_action('bbp_dashboard_widget_right_now_table_end'); ?> <div class="versions"> <span id="wp-version-message"> <?php printf(__('You are using <span class="b">bbPress %s</span>.', 'bbpress'), bbp_get_version()); ?> </span> </div> <br class="clear" /> <?php do_action('bbp_dashboard_widget_right_now_end'); }
$approved_comments = $comments_count->approved; $total_members = 0; if (defined('BP_VERSION')) { $total_members = bp_core_get_total_member_count(); } else { $result = count_users(); $total_members = $result['total_users']; } $count_posts = wp_count_posts('post'); $published_posts = $count_posts->publish; $count_posts = wp_count_posts('recipe'); $published_recipes = $count_posts->publish; $total_attachments = $wpdb->get_var($wpdb->prepare("SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_type = %s", 'attachment')); $forum_stats = null; if (function_exists('bbp_get_statistics')) { $forum_stats = bbp_get_statistics(); } /* <!--content--> <section class="content full-width"> <div class="icons dynamic-numbers"> <header class="s-title"> <h2 class="ribbon large"><?php echo sprintf(__('%s en chiffres', 'socialchef'), get_bloginfo('name')); ?></h2> </header> <!--row--> <div class="row"> <!--item--> <div class="one-fifth"> <div class="container"> <i class="ico i-members"></i>