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 | } |