Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove public group updates from SWA

  • @deshmukh

    Participant

    Running WP4.1, Buddypress 2.1.1.

    The current SWA contains all updates (profile updates) and all postings in public groups.

    I wanted to have only profile updates in SWA. Is there any way to do this?

Viewing 7 replies - 1 through 7 (of 7 total)
  • @danbp

    Participant

    @deshmukh

    Participant

    @danbp thanks! For the first time, I could read the Codex, understand it and do something meaningful!

    In my functions.php, I added the following code:

    function myown_bp_activity( $retval ) { 
        $retval['scope'] = 'friends';                                                                                          
        return $retval;
      }
    
      add_filter('bp_after_has_activities_parse_args', 'myown_bp_activity' );
    

    This makes no difference at all. I guess, default for scope is friends. If I change ‘friends’ to ‘groups’, ALL activities show only group updates.

    The area where I am groping in the dark still is:

    • How do I modify ONLY the SWA? What should be the conditional? if (bp_is_SWA)?
    • Secondly, I can get ONLY groups. But I can not still get ONLY status updates. How do I get that? What should be the scope?

    @danbp

    Participant

    How do I modify ONLY the SWA ?

    the function applies to the whole site.
    See if this works for you: $retval['action'] = 'activity_update';

    @deshmukh

    Participant

    @danbp No. That did not work. Everything is ‘default’.

    I think we will need to pass action = activity_update AND scope = groups in the function.

    How do I do that?

    And lastly, how do I define scope to include ONLY status updates (as post in ‘My Profile’)?

    @danbp

    Participant

    i tested the function and it works on my install. Do you use a cache plugin ? If yes, clear it and try again.

    You could also try to do that directly in the activity template, via your child theme.
    See bp_has_activities in bp-templates/bp-legacy/buddypress/activity/activity-loop.php

    But this will also affect the whole site activities.

    Activity Loop

    Profile specific what’s new update activity doesn’t exist outside of a user activity page.
    In other words, when you call the action filter activity_update, you’ll receive updates from “members”, “groups” and “swa activity” which is default.

    To understand, open your DB and go to bp-activity table.
    You’ll see component, type and action rows, which are used to built the SWA.
    And the comp xprofile doesn’t include activity_update action

    More doc about this in /buddypress/bp-activity-template.php:166

    @deshmukh

    Participant

    @danbp Thanks! And apologies, my questions may appear to be too basic. This is partly because I am a newbie and, I guess, partly because our documentation needs further improvement.

    I am slowly getting a hang of what happens when something goes in functions.php/bp-custom.php.

    But still I am not able to achieve something that appears to be simple. May be, I will need to ask a better question. Which I will do, in a separate thread.

    @deshmukh

    Participant
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Remove public group updates from SWA’ is closed to new replies.
Skip to toolbar