diff --git src/bp-templates/bp-legacy/buddypress-functions.php src/bp-templates/bp-legacy/buddypress-functions.php
index c2a5b9f27..1cc313bce 100644
|
|
function bp_legacy_theme_blog_create_nav() { |
711 | 711 | * @return string Query string for the component loops. |
712 | 712 | */ |
713 | 713 | function bp_legacy_theme_ajax_querystring( $query_string, $object ) { |
714 | | if ( empty( $object ) ) |
| 714 | if ( empty( $object ) ) { |
715 | 715 | return ''; |
| 716 | } |
716 | 717 | |
717 | 718 | // Set up the cookies passed on this AJAX request. Store a local var to avoid conflicts. |
718 | 719 | if ( ! empty( $_POST['cookie'] ) ) { |
719 | 720 | $_BP_COOKIE = bp_parse_args( |
720 | 721 | str_replace( '; ', '&', urldecode( $_POST['cookie'] ) ) |
721 | 722 | ); |
| 723 | } elseif ( ! empty( $_POST['data']['bp_heartbeat'] ) ) { |
| 724 | $_BP_COOKIE = bp_parse_args( |
| 725 | str_replace( '; ', '&', urldecode( $_POST['data']['bp_heartbeat'] ) ) |
| 726 | ); |
722 | 727 | } else { |
723 | 728 | $_BP_COOKIE = &$_COOKIE; |
724 | 729 | } |
… |
… |
function bp_legacy_theme_ajax_querystring( $query_string, $object ) { |
754 | 759 | } |
755 | 760 | |
756 | 761 | // Activity stream scope only on activity directory. |
757 | | if ( 'all' != $_BP_COOKIE['bp-' . $object . '-scope'] && ! bp_displayed_user_id() && ! bp_is_single_item() ) |
| 762 | if ( 'all' != $_BP_COOKIE['bp-' . $object . '-scope'] && ! bp_displayed_user_id() && ! bp_is_single_item() ) { |
758 | 763 | $qs[] = 'scope=' . urlencode( $_BP_COOKIE['bp-' . $object . '-scope'] ); |
| 764 | } |
759 | 765 | } |
760 | 766 | |
761 | 767 | // If page and search_terms have been passed via the AJAX post request, use those. |
762 | | if ( ! empty( $_POST['page'] ) && '-1' != $_POST['page'] ) |
| 768 | if ( ! empty( $_POST['page'] ) && '-1' != $_POST['page'] ) { |
763 | 769 | $qs[] = 'page=' . absint( $_POST['page'] ); |
| 770 | } |
764 | 771 | |
765 | 772 | // Excludes activity just posted and avoids duplicate ids. |
766 | 773 | if ( ! empty( $_POST['exclude_just_posted'] ) ) { |
… |
… |
function bp_legacy_theme_ajax_querystring( $query_string, $object ) { |
778 | 785 | } |
779 | 786 | |
780 | 787 | $object_search_text = bp_get_search_default_text( $object ); |
781 | | if ( ! empty( $_POST['search_terms'] ) && is_string( $_POST['search_terms'] ) && $object_search_text != $_POST['search_terms'] && 'false' != $_POST['search_terms'] && 'undefined' != $_POST['search_terms'] ) |
| 788 | if ( ! empty( $_POST['search_terms'] ) && is_string( $_POST['search_terms'] ) && $object_search_text != $_POST['search_terms'] && 'false' != $_POST['search_terms'] && 'undefined' != $_POST['search_terms'] ) { |
782 | 789 | $qs[] = 'search_terms=' . urlencode( $_POST['search_terms'] ); |
| 790 | } |
783 | 791 | |
784 | 792 | // Now pass the querystring to override default values. |
785 | 793 | $query_string = empty( $qs ) ? '' : join( '&', (array) $qs ); |
786 | 794 | |
787 | 795 | $object_filter = ''; |
788 | | if ( isset( $_BP_COOKIE['bp-' . $object . '-filter'] ) ) |
| 796 | if ( isset( $_BP_COOKIE['bp-' . $object . '-filter'] ) ) { |
789 | 797 | $object_filter = $_BP_COOKIE['bp-' . $object . '-filter']; |
| 798 | } |
790 | 799 | |
791 | 800 | $object_scope = ''; |
792 | | if ( isset( $_BP_COOKIE['bp-' . $object . '-scope'] ) ) |
| 801 | if ( isset( $_BP_COOKIE['bp-' . $object . '-scope'] ) ) { |
793 | 802 | $object_scope = $_BP_COOKIE['bp-' . $object . '-scope']; |
| 803 | } |
794 | 804 | |
795 | 805 | $object_page = ''; |
796 | | if ( isset( $_BP_COOKIE['bp-' . $object . '-page'] ) ) |
| 806 | if ( isset( $_BP_COOKIE['bp-' . $object . '-page'] ) ) { |
797 | 807 | $object_page = $_BP_COOKIE['bp-' . $object . '-page']; |
| 808 | } |
798 | 809 | |
799 | 810 | $object_search_terms = ''; |
800 | | if ( isset( $_BP_COOKIE['bp-' . $object . '-search-terms'] ) ) |
| 811 | if ( isset( $_BP_COOKIE['bp-' . $object . '-search-terms'] ) ) { |
801 | 812 | $object_search_terms = $_BP_COOKIE['bp-' . $object . '-search-terms']; |
| 813 | } |
802 | 814 | |
803 | 815 | $object_extras = ''; |
804 | | if ( isset( $_BP_COOKIE['bp-' . $object . '-extras'] ) ) |
| 816 | if ( isset( $_BP_COOKIE['bp-' . $object . '-extras'] ) ) { |
805 | 817 | $object_extras = $_BP_COOKIE['bp-' . $object . '-extras']; |
| 818 | } |
806 | 819 | |
807 | 820 | /** |
808 | 821 | * Filters the AJAX query string for the component loops. |
diff --git src/bp-templates/bp-legacy/js/buddypress.js src/bp-templates/bp-legacy/js/buddypress.js
index adce49986..2d10c0016 100644
|
|
jq( function() { |
1755 | 1755 | } |
1756 | 1756 | |
1757 | 1757 | data.bp_activity_last_recorded = activity_last_recorded; |
| 1758 | data.bp_heartbeat = bp_get_cookies() || encodeURIComponent( jq.param( { 'bp-activity-scope': null } ) ); |
1758 | 1759 | |
1759 | 1760 | last_recorded_search = bp_get_querystring('s'); |
1760 | 1761 | |