Skip to:
Content
Pages
Categories
Search
Top
Bottom

Stop posts and updates from a single blog showing up in the mainpage activity stream

  • Avatar of Mark
    Mark
    Participant

    @markhahnel

    Is it possible to stop posts and updates from a single blog showing up in the mainpage activity stream.

    I am running wpmu 3.0.1 bp 1.2.5.2 and have about 10 blogs running. I want to add a new blog but do not want the updates to show up in the main page activity stream.

    Any help much appreciated!

Viewing 17 replies - 1 through 17 (of 17 total)
  • Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    Two options spring to mind:

    1. You could add a filter on new blog posts creating an activity stream entry, check the blog id, and exclude appropriately. A bit of searching in the BuddyPress plugin files should find the correct filter to add.

    2. Or, in your activity stream loop, check the activity item id and don’t display if it’s for the blog you want to exclude

    Avatar of Mark
    Mark
    Participant

    @markhahnel

    Thanks @Rogercoathup – Where would I find the activity stream loop?

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    @markhahnel

    You can adapt the code snippet in here by changing the blog id: http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/posts-of-the-main-blog-in-site-wide-activity/

    If your theme follows the default structure, you’ll find your activity loop in my-theme/activity/activity-loop.php

    Also have a look at the custom loop documentation (click documentation under support tab) on this site

    think i’m going to update my block activity type plugin to allow more granular control over the item_id and types

    but here is a code snippet i quickly modified from that plugin (untested – so double check). in theory, just replace INSERT_THE_BLOG_ID_HERE with the blog_id you want to block. (note this blocks new updates to the db, you would need to remove previous ones)

    `
    //if php is older then change $a to &$a
    function my_block_activity_type_blog_id_before_save( $type, $a ) {
    global $bp;

    //if there is an id – we don’t care… updating
    if ( $a->id )
    return $type;

    //Come and see the violence inherent in the system. Help! Help! I’m being repressed!
    if ( $a->type == ‘new_blog_post’ || $a->type == ‘new_blog_comment’ ) {

    //item_id is the blog_id in this context
    if ( $a->item_id == INSERT_THE_BLOG_ID_HERE ) {
    $a->type = null;
    return null;
    }
    }

    //otherwise continue if nothing happened
    return $type;
    }
    add_filter(‘bp_activity_type_before_save’, ‘my_block_activity_type_blog_id_before_save’, 9999, 2);
    `

    Avatar of Mark
    Mark
    Participant

    @markhahnel

    Thanks @rofercoathup and thanks @nuprn1

    Rich, where would I add that code, to the activity loop?

    Thanks again.

    functions/bp-custom file – but with that code snippet you won’t be able to recover the data going forward (blocked from the db) – make sure you test it

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    @markhahnel -

    The solution from @nuprn1 is essentially the details for implementing option 1 that I suggested above, the code snippet I gave you is the option 2 solution.

    Avatar of Mark
    Mark
    Participant

    @markhahnel

    Thats fine @nuprn1 , I dont want to recover data. I am quite experienced with this now, but I cant find the functions folder, in the theme editor, it isnt there, is it in the buddypress plugin file? Im using suffusion theme?

    Thanks a lot Rich

    Avatar of Mark
    Mark
    Participant

    @markhahnel

    Thanks @rogercoathup – do you know where I’d find this file to edit? Thanks

    Avatar of Mark
    Mark
    Participant

    @markhahnel

    Ok guys, so I think I should be going to bp-default theme in the theme editor, and copying in the code that rich gave me but putting the blog id in. ie. in this case ‘blogstest’.

    If so, its not working? Am I going to the wrong place?

    search up on placing code snippets in the theme’s function.php or creating a bp-custom.php

    the blog_id is not the name of the blog but rather the numerical value in the db for that blog.

    Avatar of Mark
    Mark
    Participant

    @markhahnel

    Ahh, thanks @nuprn1 – I have a bp-custom file, Im just being stupid. Just the numerical id to find. Thanks again.

    Avatar of Mark
    Mark
    Participant

    @markhahnel

    @nuprn1 – That one doesnt work – I’m going to give @rogercoathup s suggestion a go.

    Avatar of Mark
    Mark
    Participant

    @markhahnel

    @rogercoathup @nuprn1 – Both dont seem to work.

    Avatar of Mark
    Mark
    Participant

    @markhahnel

    Can anyone else think of any other snippets I can add to the bp-custom.php to block new posts in one specific blog showing up in the activity stream?

    ie. My blog_id is 282 and I have tried the 2 codes above?

    Avatar of Mark
    Mark
    Participant

    @markhahnel

    Stop the clock @nuprn1 – Yours worked, I hadnt opied the code completely, missing the //

    You guys are great, thanks for the help @rogercoathup

    Thanks

    :-P thanks for testing it… i’ll add this to my plugin after bp1.2.6 hits. i see this question a bit (along with blocking a certain blog category)

Viewing 17 replies - 1 through 17 (of 17 total)

You must be logged in to reply to this topic.