Adding comment counts to BuddyBar
-
I’ve been trying to make a custom buddybar tweak (following these epic directions: http://codex.buddypress.org/how-to-guides/modifying-the-buddypress-admin-bar/ ) to show any pending comments I may have per blog.
The problem I ran into is having the foreach blog loop call the site ID:
if ( is_array( $blogs ) && (int)$blogs ) {
$counter = 0;
foreach ( (array)$blogs as $blog ) {
$alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
$site_url = esc_attr( $blog->siteurl );
$site_id = esc_attr( $blog->id );
$site_id = 'wp_' .$site_id. '_comments';
$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $site_id WHERE comment_approved = '0'");
if (0 < $numcomms) $numcomms = number_format($numcomms);
echo '- ';
echo '' . esc_html( $blog->name ) . '';
echo '- ';
- ' . __( 'Dashboard', 'buddypress' ) . '
- ' . __( 'New Post', 'buddypress' ) . '
- ' . __( 'Manage Posts', 'buddypress' ) . '
- ' . __( 'Manage Comments', 'buddypress' ) . ' (' . $site_id . ')';
echo '
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
$counter++;
}
}
Right now I’m still calling `$site_id` so I can see what site ID it thinks it’s calling.
The numbers it spits back are wrong. So I think `$site_id = esc_attr( $blog->id );` isn’t right but I’m not sure where I went off the path on that one.
- ';
You must be logged in to reply to this topic.
