Skip to:
Content

BuddyPress.org

Ticket #4062: 4062.diff

File 4062.diff, 1.5 KB (added by lakrisgubben, 8 years ago)
  • src/bp-templates/bp-legacy/buddypress-functions.php

     
    687687
    688688        // Activity stream filtering on action.
    689689        if ( ! empty( $_BP_COOKIE['bp-' . $object . '-filter'] ) && '-1' != $_BP_COOKIE['bp-' . $object . '-filter'] ) {
    690                 $qs[] = 'type='   . $_BP_COOKIE['bp-' . $object . '-filter'];
    691                 $qs[] = 'action=' . $_BP_COOKIE['bp-' . $object . '-filter'];
     690                // Set default context based on current page.
     691
     692                // On member pages, default to 'member', unless this
     693                // is a user's Groups activity.
     694                if ( bp_is_user() ) {
     695                        if ( bp_is_active( 'groups' ) && bp_is_current_action( bp_get_groups_slug() ) ) {
     696                                $context = 'member_groups';
     697                        } else {
     698                                $context = 'member';
     699                        }
     700
     701                // On individual group pages, default to 'group'.
     702                } elseif ( bp_is_active( 'groups' ) && bp_is_group() ) {
     703                        $context = 'group';
     704
     705                // 'activity' everywhere else.
     706                } else {
     707                        $context = 'activity';
     708                }
     709
     710                foreach ( bp_activity_get_actions() as $actions ) {
     711                        foreach ( $actions as $action ) {
     712                                if ( $action['key'] === $_BP_COOKIE['bp-' . $object . '-filter'] && in_array( $context, (array) $action['context'] ) ) {
     713                                        $qs[] = 'type='   . $_BP_COOKIE['bp-' . $object . '-filter'];
     714                                        $qs[] = 'action=' . $_BP_COOKIE['bp-' . $object . '-filter'];
     715                                }
     716                        }
     717                }
    692718        }
    693719
    694720        if ( ! empty( $_BP_COOKIE['bp-' . $object . '-scope'] ) ) {