Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove friend notifications for all activity page


  • Steve
    Participant

    @aksteve

    I have searched the forum for this and found many people asking about it, but I have yet to find a solution.

    When someone friends another person the All Members activity page shows “User X and User Y are now friends”. This ends up filling the entire page. Which is very annoying. Plus, for my clients purposes, this is absolutely useless.

    How do I get rid of this notification?? I just want “Updates” to show up.

    I found this article (https://codex.buddypress.org/developer/loops-reference/the-activity-stream-loop/#filtering-examples), but I am not a developer, so telling me to add a loop without telling me “where” to put it doesn’t help.

    Like I said, I have seen other people ask about this, but have yet to find the solution.

    Thanks in advance for the help.

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

  • shanebp
    Moderator

    @shanebp

    You can place this in your theme/functions.php or in bp-custom.php.

    It will stop recording entries for 3 types after you include the function.
    You can add other types as desired to the $exclude array.

    function steve_dont_save_activity( $activity_object ) {
     
        $exclude = array( 'new_avatar', 'updated_profile', 'friendship_created' );
     
        if( in_array( $activity_object->type, $exclude ) )
            $activity_object->type = false;
     
    }
    add_action('bp_activity_before_save', 'steve_dont_save_activity', 1, 1 );

    To delete existing entries, use the interface here
    [yoursite]/wp-admin/admin.php?page=bp-activity


    Steve
    Participant

    @aksteve

    THanks for the response. I am getting an error when adding this, any thoughts?

    function steve_dont_save_activity( $activity_object ) { $exclude = array( ‘new_avatar’, ‘updated_profile’, ‘friendship_created’ ); if( in_array( $activity_object->type, $exclude ) ) $activity_object->type = false; } add_action(‘bp_activity_before_save’, ‘steve_dont_save_activity’, 1, 1 );
    Warning: Cannot modify header information – headers already sent by (output started at /home2/sparker/public_html/jungportal.com/wp-content/plugins/bp-custom.php:13) in /home2/sparker/public_html/jungportal.com/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 62


    Steve
    Participant

    @aksteve

    Wait. I think I got it to work. I originally put it in the bp-custom file but then switched it to my child theme function file. I think it is working. I will let you know.

    Thanks.


    danbp
    Participant

    @danbp

    The function should be in one file only. And you are using a cache. Clear it !


    shweikiart
    Participant

    @shweikiart

    i need to remove (are now friend, became a registered member, change profile or cover photo) in all activity pages, any help please?


    mrsminkie
    Participant

    @mrsminkie

    @shwikiart

    Try this: https://codex.buddypress.org/developer/loops-reference/the-activity-stream-loop/#filtering-examples

    Copy the activity-loop.php file into your child theme and then update line 18 with the settings that suit you using the guide in the link to help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove friend notifications for all activity page’ is closed to new replies.
Skip to toolbar