BuddyDev

Search

[Resolved] Does MediaPress support activity scopes ['scope'] = '';

  • Participant
    Level: Enlightened
    Posts: 56
    Andy on #1602

    Hi Brajesh, one more question, does MediaPress support activity scopes so we can use bp_after_has_activities_parse_args.
    https://codex.buddypress.org/developer/using-bp_parse_args-to-filter-buddypress-template-loops/

    Here is someone asking this question for the buddypress followers plugin(their alpha master version supports activity scopes, that I use):
    https://wordpress.org/support/topic/loopscope-following-not-working-in-plugin?replies=5

    If so, what is the scope name called?
    [‘scope’] = ”;

    I tried to look through some of the MediaPress files to find the scope name but I don’t really know where to look.

    Thanks in advance.

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #1603

    Hi Andy,
    Thank you for asking.
    The scope will be “mpp_media_upload”

    It is the activity type. Hope that helps.

  • Participant
    Level: Enlightened
    Posts: 56
    Andy on #1689

    Thanks. I meant to say the activity action type, not the scope. But ‘mpp_media_upload’ is working for the action type too. I’m not a great coder, I just have some coding and BuddyPress knowledge to enhance my theme, I removed the activity sub menu filter on the main activity page and managed to come up with something like the code below, and it now all works great, unless you notice anything wrong with it:

    /**
    * Filter activity loop
    *
    * Display just the activity updates (with media) on front-page from the logged in user and
    * from who a logged in user is following
    */
    function cm_activity_filter( $retval ) {

    if ( bp_is_activity_front_page() ) {
    $retval[‘scope’] = ‘following,just-me’;
    $retval[‘action’] = ‘activity_update,mpp_media_upload’;
    }

    return $retval;
    }
    add_filter( ‘bp_after_has_activities_parse_args’, ‘cm_activity_filter’ );

    • This reply was modified 8 years, 5 months ago by Andy.
  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #1702

    Hi Andy,
    Thank you.
    That code looks fine to me 🙂
    Glad that it is resolved.

    Regards
    Brajesh

The topic ‘ [Resolved] Does MediaPress support activity scopes ['scope'] = '';’ is closed to new replies.

This topic is: resolved