Warning: This function has been deprecated. bbPress (r5268) instead.
bbp_dashboard_widget_right_now()
bbPress Dashboard Right Now Widget
Description Description
Adds a dashboard widget with forum statistics
Source Source
File: includes/admin/metaboxes.php
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_int'], 'bbpress' );
if ( current_user_can( 'publish_forums' ) ) {
$link = add_query_arg( array( 'post_type' => bbp_get_forum_post_type() ), admin_url( '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_int'], 'bbpress' );
if ( current_user_can( 'publish_topics' ) ) {
$link = add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( '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_int'], 'bbpress' );
if ( current_user_can( 'publish_replies' ) ) {
$link = add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( '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_int'], '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() ), admin_url( '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 endif; ?>
<?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_int'], 'bbpress' );
if ( current_user_can( 'edit_users' ) ) {
$link = admin_url( '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_int'], 'bbpress' );
$link = add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( '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 endif; ?>
<?php if ( isset( $r['reply_count_hidden'] ) ) : ?>
<tr>
<?php
$num = $r['reply_count_hidden'];
$text = _n( 'Hidden Reply', 'Hidden Replies', $r['reply_count_hidden_int'], 'bbpress' );
$link = add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( '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 endif; ?>
<?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_int'], 'bbpress' );
$link = add_query_arg( array( 'taxonomy' => bbp_get_topic_tag_tax_id(), 'post_type' => bbp_get_topic_post_type() ), admin_url( '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 endif; ?>
<?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' );
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.6.0 | bbPress (r5268) |
| 2.0.0 | Introduced. |