Skip to:
Content

BuddyPress.org

Changeset 8817


Ignore:
Timestamp:
08/12/2014 09:04:05 PM (5 years ago)
Author:
imath
Message:

Add search support in Ajax "Load More" and "Load Newest" activity actions

If a search is performed in activities using the query string "?s=search_terms", make sure the search terms are sent in the ajax arguments of the "Load More" and the "Load Newest" actions.

Fixes #5779

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-filters.php

    r8730 r8817  
    460460        return $classes;
    461461    }
    462    
     462
    463463    $classes .= ' date-recorded-' . strtotime( $activity_date );
    464464
     
    492492        'activity_latest_args'
    493493    );
     494
     495    if ( ! empty( $data['bp_activity_last_recorded_search_terms'] ) && empty( $activity_latest_args['search_terms'] ) ) {
     496        $activity_latest_args['search_terms'] = addslashes( $data['bp_activity_last_recorded_search_terms'] );
     497    }
    494498
    495499    $newest_activities = array();
  • trunk/src/bp-templates/bp-legacy/js/buddypress.js

    r8470 r8817  
    417417            });
    418418
    419             bp_ajax_request = jq.post( ajaxurl, {
     419            load_more_args = {
    420420                action: 'activity_get_older_updates',
    421421                'cookie': bp_get_cookies(),
    422422                'page': oldest_page,
    423423                'exclude_just_posted': just_posted.join(',')
    424             },
     424            }
     425
     426            load_more_search = bp_get_querystring('s');
     427
     428            if ( load_more_search ) {
     429                load_more_args.search_terms = load_more_search;
     430            }
     431
     432            bp_ajax_request = jq.post( ajaxurl, load_more_args,
    425433            function(response)
    426434            {
     
    16131621
    16141622        data.bp_activity_last_recorded = activity_last_recorded;
     1623
     1624        last_recorded_search = bp_get_querystring('s');
     1625
     1626        if ( last_recorded_search ) {
     1627            data.bp_activity_last_recorded_search_terms = last_recorded_search;
     1628        }
    16151629    });
    16161630
Note: See TracChangeset for help on using the changeset viewer.