Skip to:
Content
Pages
Categories
Search
Top
Bottom

Block activity stream types

  • Avatar of benny390
    benny390
    Participant

    @benny390

    Hi,

    I’m very new to buddypress and I just made my first site using WordPress 3.8.1, Buddypress 1.9.2 and the Buddyboss theme.

    No I would like to block posts on the activity stream when a new member signs up and when someone starts a topic on the forum (bbpress). The problem with the last is that users just comment on the topic in the activity stream but don’t answer on the forum topic itself.

    I tried a plugin called BuddyPress Block Activity Stream Types but it always shows the error message:
    Warning: Missing argument 2 for wpdb::prepare(), called in /home/user/public_html/wp-content/plugins/buddypress-block-activity-stream-types/admin/bp-activity-block-admin.php on line 6 and defined in /home/user/public_html/wp-includes/wp-db.php on line 992

    What can I do to solve this or to block different activity types?

    Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Avatar of palmdoc
    palmdoc
    Participant

    @palmdoc

    I also tried the plugin

    http://wordpress.org/plugins/buddypress-block-activity-stream-types/

    but it seems it’s an orphaned one not updated for a couple of years
    What I really hope to do is to prevent bbPress new topics and replies from appearing in the Activity stream – it’s really quite redundant I feel

    Help anyone?

    @palmdoc, @benny390

    You can try @imath solution and edit it accordingly to include bbpress.

    /* beginning of the code to paste in the functions.php of your active theme */

    ‘function imath_activivity_dont_save( $activity_object ) {
    // friendship_created is fired when a member accepts a friend request
    // joined_group is fired when a member joins a group.
    $exclude = array( ‘friendship_created’, ‘joined_group’);

    // if the activity type is empty, it stops BuddyPress BP_Activity_Activity::save() function
    if( in_array( $activity_object->type, $exclude ) )
    $activity_object->type = false;

    }

    ‘add_action(‘bp_activity_before_save’, ‘imath_activivity_dont_save’, 10, 1 );’

    Avatar of sharmavishal
    sharmavishal
    Participant

    @sharmavishal

    BuddyPress Block Activity Stream Types is working absolutely fine even with BP 2.0

    Avatar of palmdoc
    palmdoc
    Participant

    @palmdoc

    @sharmavishal: It doesn’t seem to work for me
    I put Blocked Activity Types:
    new_forum_topic, new_forum_post
    and the bbPress topics and replies still go thru

    @naijaping and anyone, what should the code be? Like this? :

    // Filter bbPress from updating activity stream
    function imath_activity_dont_save( $activity_object ) {
    $exclude = array( 'new_forum_topic', 'new_forum_post');
    
    // if the activity type is empty, it stops BuddyPress BP_Activity_Activity::save() function
    if( in_array( $activity_object->type, $exclude ) )
    $activity_object->type = false;
    
    }
    
    add_action('bp_activity_before_save', 'imath_activity_dont_save', 10, 1 );
    Avatar of palmdoc
    palmdoc
    Participant

    @palmdoc

    I just tried that and it doesn’t prevent bbPress from updating the Activity stream :(

    Avatar of palmdoc
    palmdoc
    Participant

    @palmdoc

    OK got the types wrong and got to=he info from the table in phpmyadmin

    Anyway this code works in ones custom function.php

    // Filter bbPress from updating activity stream
    function imath_activity_dont_save( $activity_object ) {
    $exclude = array( 'bbp_topic_create', 'bbp_reply_create');
    
    // if the activity type is empty, it stops BuddyPress BP_Activity_Activity::save() function
    if( in_array( $activity_object->type, $exclude ) )
    $activity_object->type = false;
    
    }
    
    add_action('bp_activity_before_save', 'imath_activity_dont_save', 10, 1 );

    @benny390, @palmdoc, glad its all sorted

    Naijaping

    Avatar of palmdoc
    palmdoc
    Participant

    @palmdoc

    @naijaping thank you!

    Avatar of Marvin Alexander
    Marvin Alexander
    Participant

    @ptvstudios

    @naijaping

    What would I use to block these? I see ‘friendship_created’, ‘joined_group’ for example…

    “username joined the group YOGA” would be “joined_group”
    “username and anotheruser are now friends” is this one ‘friendship_created’?
    “username changed their profile picture” ???
    “username became a registered member” ???

    Thanks!

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

You must be logged in to reply to this topic.