Skip to:
Content

BuddyPress.org

Ticket #9258: 9258.01.patch

File 9258.01.patch, 4.1 KB (added by emaralive, 6 months ago)

Initial patch

  • src/bp-templates/bp-legacy/buddypress-functions.php

    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() { 
    711711 * @return string Query string for the component loops.
    712712 */
    713713function bp_legacy_theme_ajax_querystring( $query_string, $object ) {
    714         if ( empty( $object ) )
     714        if ( empty( $object ) ) {
    715715                return '';
     716        }
    716717
    717718        // Set up the cookies passed on this AJAX request. Store a local var to avoid conflicts.
    718719        if ( ! empty( $_POST['cookie'] ) ) {
    719720                $_BP_COOKIE = bp_parse_args(
    720721                        str_replace( '; ', '&', urldecode( $_POST['cookie'] ) )
    721722                );
     723        } elseif ( ! empty( $_POST['data']['bp_heartbeat'] ) ) {
     724                $_BP_COOKIE = bp_parse_args(
     725                        str_replace( '; ', '&', urldecode( $_POST['data']['bp_heartbeat'] ) )
     726                );
    722727        } else {
    723728                $_BP_COOKIE = &$_COOKIE;
    724729        }
    function bp_legacy_theme_ajax_querystring( $query_string, $object ) { 
    754759                }
    755760
    756761                // 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() ) {
    758763                        $qs[] = 'scope=' . urlencode( $_BP_COOKIE['bp-' . $object . '-scope'] );
     764                }
    759765        }
    760766
    761767        // 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'] ) {
    763769                $qs[] = 'page=' . absint( $_POST['page'] );
     770        }
    764771
    765772        // Excludes activity just posted and avoids duplicate ids.
    766773        if ( ! empty( $_POST['exclude_just_posted'] ) ) {
    function bp_legacy_theme_ajax_querystring( $query_string, $object ) { 
    778785        }
    779786
    780787        $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'] ) {
    782789                $qs[] = 'search_terms=' . urlencode( $_POST['search_terms'] );
     790        }
    783791
    784792        // Now pass the querystring to override default values.
    785793        $query_string = empty( $qs ) ? '' : join( '&', (array) $qs );
    786794
    787795        $object_filter = '';
    788         if ( isset( $_BP_COOKIE['bp-' . $object . '-filter'] ) )
     796        if ( isset( $_BP_COOKIE['bp-' . $object . '-filter'] ) ) {
    789797                $object_filter = $_BP_COOKIE['bp-' . $object . '-filter'];
     798        }
    790799
    791800        $object_scope = '';
    792         if ( isset( $_BP_COOKIE['bp-' . $object . '-scope'] ) )
     801        if ( isset( $_BP_COOKIE['bp-' . $object . '-scope'] ) ) {
    793802                $object_scope = $_BP_COOKIE['bp-' . $object . '-scope'];
     803        }
    794804
    795805        $object_page = '';
    796         if ( isset( $_BP_COOKIE['bp-' . $object . '-page'] ) )
     806        if ( isset( $_BP_COOKIE['bp-' . $object . '-page'] ) ) {
    797807                $object_page = $_BP_COOKIE['bp-' . $object . '-page'];
     808        }
    798809
    799810        $object_search_terms = '';
    800         if ( isset( $_BP_COOKIE['bp-' . $object . '-search-terms'] ) )
     811        if ( isset( $_BP_COOKIE['bp-' . $object . '-search-terms'] ) ) {
    801812                $object_search_terms = $_BP_COOKIE['bp-' . $object . '-search-terms'];
     813        }
    802814
    803815        $object_extras = '';
    804         if ( isset( $_BP_COOKIE['bp-' . $object . '-extras'] ) )
     816        if ( isset( $_BP_COOKIE['bp-' . $object . '-extras'] ) ) {
    805817                $object_extras = $_BP_COOKIE['bp-' . $object . '-extras'];
     818        }
    806819
    807820        /**
    808821         * Filters the AJAX query string for the component loops.
  • src/bp-templates/bp-legacy/js/buddypress.js

    diff --git src/bp-templates/bp-legacy/js/buddypress.js src/bp-templates/bp-legacy/js/buddypress.js
    index adce49986..2d10c0016 100644
    jq( function() { 
    17551755                }
    17561756
    17571757                data.bp_activity_last_recorded = activity_last_recorded;
     1758                data.bp_heartbeat = bp_get_cookies() || encodeURIComponent( jq.param( { 'bp-activity-scope': null } ) );
    17581759
    17591760                last_recorded_search = bp_get_querystring('s');
    17601761