I want bp_blog_widgets.php to include only Blog 1
-
So I have already modified the bp_blogs_widget.php file to remove the word “Blog” and to show excerpts for all of the posts on the page.
What I really want to do is force that widget to show posts ONLY from Blog1…the main blog. I don’t want all of the other blogs posts to appear. I have all of the main writers linked up to Blog1, but I want members and other random people to still be able to create a blog if they wish. I just don’t want their posts on the front page.
So what do I need to change in the php file? I’m pretty sure it’s something around this piece of code…
[<?php $posts = bp_blogs_get_latest_posts( null, $options ) ?>]
My website is http://www.mmaopinion.com
Thanks!
-
Anyone? It’s the last thing that’s keeping me from allowing others to create blogs at this point.
I really like the look of the bp plugin, I just want to exclude all other blogs aside from Blog_1.
Thanks!
Following the chain of functions:
<?php $posts = bp_blogs_get_latest_posts( null, $options ) ?>
to this:
function bp_blogs_get_latest_posts( $blog_id = null, $limit = 5 ) {
global $bp;
if ( !is_numeric( $limit ) )
$limit = 5;
return BP_Blogs_Post::get_latest_posts( $blog_id, $limit );
}
gets me to this:
function get_latest_posts( $blog_id = null, $limit = 5 ) {
global $wpdb, $bp;
if ( !$bp->blogs )
bp_blogs_setup_globals();
if ( $blog_id )
$blog_sql = $wpdb->prepare( ” AND p.blog_id = %d”, $blog_id );
$post_ids = $wpdb->get_results( $wpdb->prepare( “SELECT DISTINCT p.post_id, p.blog_id FROM {$bp->blogs->table_name_blog_posts} p LEFT JOIN {$wpdb->base_prefix}blogs b ON p.blog_id = b.blog_id WHERE b.public = 1 AND b.deleted = 0 AND b.archived = ‘0’ AND b.spam = 0 AND b.mature = 0 $blog_sql ORDER BY p.date_created DESC LIMIT $limit” ) );
for ( $i = 0; $i < count($post_ids); $i++ ) {
$posts[$i] = BP_Blogs_Post::fetch_post_content($post_ids[$i]);
}
return $posts;
}
Where I see that changing ‘null’ to ‘1’ in bp_blogs_get_latest_posts() will get me posts only from blog id 1.
That was easier than I imagined. I couldn’t experiment because the blog was live and my test install was hosted on a shared server that didn’t support subdomain blogs.
Thanks!
- The topic ‘I want bp_blog_widgets.php to include only Blog 1’ is closed to new replies.