Skip to:
Content

BuddyPress.org

Changeset 2422


Ignore:
Timestamp:
01/24/2010 02:29:57 PM (14 years ago)
Author:
apeatling
Message:

Fixes #1661

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-templatetags.php

    r2415 r2422  
    485485            $link = $bp->displayed_user->domain . $user_nav_item['link'];
    486486
    487         echo apply_filters( 'bp_get_displayed_user_nav_' . $user_nav_item['css_id'], '<li id="li-subnav-' . $user_nav_item['css_id'] . '" ' . $selected . '><a id="user-' . $user_nav_item['css_id'] . '" href="' . $link . '">' . $user_nav_item['name'] . '</a></li>', &$user_nav_item );
     487        echo apply_filters( 'bp_get_displayed_user_nav_' . $user_nav_item['css_id'], '<li id="' . $user_nav_item['css_id'] . '-personal" ' . $selected . '><a id="user-' . $user_nav_item['css_id'] . '" href="' . $link . '">' . $user_nav_item['name'] . '</a></li>', &$user_nav_item );
    488488    }
    489489}
     
    532532
    533533            /* echo out the final list item */
    534             echo apply_filters( 'bp_get_options_nav_' . $subnav_item['css_id'], '<li id="li-subnav-' . $subnav_item['css_id'] . '" ' . $selected . '><a id="' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>', $subnav_item );
     534            echo apply_filters( 'bp_get_options_nav_' . $subnav_item['css_id'], '<li id="' . $subnav_item['css_id'] . '-personal-li" ' . $selected . '><a id="' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>', $subnav_item );
    535535        }
    536536    } else {
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r2413 r2422  
    1010 */
    1111
    12 function bp_dtheme_content_filter() {
    13     global $bp;
    14 
    15     $content = esc_attr( $_POST['content'] );
    16     $type = esc_attr( $_POST['type'] );
     12function bp_dtheme_object_filter() {
     13    global $bp;
     14
     15    $object = esc_attr( $_POST['object'] );
    1716    $filter = esc_attr( $_POST['filter'] );
    1817    $page = esc_attr( $_POST['page'] );
    1918    $search_terms = esc_attr( $_POST['search_terms'] );
    2019
     20    /**
     21     * Scope is the scope of results to use, either all (everything) or personal (just mine).
     22     * For example if the object is groups, it would be all groups, or just groups I belong to.
     23     */
     24    $scope = esc_attr( $_POST['scope'] );
     25
    2126    /* Plugins can pass extra parameters and use the bp_dtheme_ajax_querystring_content_filter filter to parse them */
    2227    $extras = esc_attr( $_POST['extras'] );
     
    2934        $filter = 'active';
    3035
    31     if ( empty( $type ) )
    32         $type = 'all';
    33 
    3436    $bp->ajax_querystring = 'type=' . $filter . '&page=' . $page;
    3537
     
    3739        $bp->ajax_querystring .= '&search_terms=' . $search_terms;
    3840
    39     if ( $type != 'all' || $bp->displayed_user->id ) {
     41    if ( $scope != 'all' || $bp->displayed_user->id ) {
    4042        $user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
    4143        $bp->ajax_querystring .= '&user_id=' . $user_id;
     
    4446    $bp->ajax_querystring = apply_filters( 'bp_dtheme_ajax_querystring_content_filter', $bp->ajax_querystring, $extras );
    4547
    46     locate_template( array( "$content/$content-loop.php" ), true );
    47 }
    48 add_action( 'wp_ajax_members_filter', 'bp_dtheme_content_filter' );
    49 add_action( 'wp_ajax_groups_filter', 'bp_dtheme_content_filter' );
    50 add_action( 'wp_ajax_blogs_filter', 'bp_dtheme_content_filter' );
    51 add_action( 'wp_ajax_forums_filter', 'bp_dtheme_content_filter' );
     48    locate_template( array( "$object/$object-loop.php" ), true );
     49}
     50add_action( 'wp_ajax_members_filter', 'bp_dtheme_object_filter' );
     51add_action( 'wp_ajax_groups_filter', 'bp_dtheme_object_filter' );
     52add_action( 'wp_ajax_blogs_filter', 'bp_dtheme_object_filter' );
     53add_action( 'wp_ajax_forums_filter', 'bp_dtheme_object_filter' );
    5254
    5355function bp_dtheme_post_update() {
  • trunk/bp-themes/bp-default/_inc/global.js

    r2403 r2422  
    1212    /* Members */
    1313    if ( j('div.members').length )
    14         bp_filter_request( j.cookie('bp-members-type'), j.cookie('bp-members-filter'), 'members', 'div.members' );
     14        bp_filter_request( 'members', j.cookie('bp-members-filter'), j.cookie('bp-members-scope'), 'div.members' );
    1515
    1616    /* Groups */
    1717    if ( j('div.groups').length )
    18         bp_filter_request( j.cookie('bp-groups-type'), j.cookie('bp-groups-filter'), 'groups', 'div.groups' );
     18        bp_filter_request( 'groups', j.cookie('bp-groups-filter'), j.cookie('bp-groups-scope'), 'div.groups' );
    1919
    2020    /* Blogs */
    2121    if ( j('div.blogs').length )
    22         bp_filter_request( j.cookie('bp-blogs-type'), j.cookie('bp-blogs-filter'), 'blogs', 'div.blogs' );
     22        bp_filter_request( 'blogs', j.cookie('bp-blogs-filter'), j.cookie('bp-blogs-scope'), 'div.blogs' );
    2323
    2424    /* Forums */
    2525    if ( j('div.forums').length ) {
    2626        j('div#new-topic-post').hide();
    27         bp_filter_request( j.cookie('bp-forums-type'), j.cookie('bp-forums-filter'), 'forums', 'div.forums' );
     27        bp_filter_request( 'forums', j.cookie('bp-forums-filter'), j.cookie('bp-forums-scope'), 'div.forums' );
    2828    }
    2929
     
    535535            var object = css_id[0];
    536536
    537             bp_filter_request( j.cookie('bp-' + object + '-type'), j.cookie('bp-' + object + '-filter'), object, 'div.' + object, 1, target.parent().children('label').children('input').val() );
     537            bp_filter_request( object, j.cookie('bp-' + object + '-filter'), j.cookie('bp-' + object + '-scope') , 'div.' + object, target.parent().children('label').children('input').val(), 1 );
    538538        }
    539539
     
    557557                return false;
    558558
    559             var type = css_id[1];
     559            var scope = css_id[1];
    560560            var filter = j("#" + object + "-order-select select").val();
    561561            var search_terms = j("#" + object + "_search").val();
     
    567567            j('li#' + object + '-' + filter).addClass('selected');
    568568
    569             bp_filter_request( type, filter, object, 'div.' + object, 1, search_terms );
     569            bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1 );
    570570
    571571            return false;
     
    582582        var css_id = el.attr('id').split('-');
    583583        var object = css_id[0];
    584         var type = css_id[1];
     584        var scope = css_id[1];
    585585        var filter = j(this).val();
    586586        var search_terms = j("#" + object + "_search").val();
    587587
    588         bp_filter_request( type, filter, object, 'div.' + object, 1, search_terms );
     588        bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1 );
    589589
    590590        return false;
     
    592592
    593593    /* Filter the current content list (groups/members/blogs/topics) */
    594     function bp_filter_request( type, filter, id, target, page, search_terms, extras ) {
    595         if ( 'activity' == id )
    596             return false;
    597 
    598         if ( null == type )
    599             var type = 'all';
     594    function bp_filter_request( object, filter, scope, target, search_terms, page, extras ) {
     595        if ( 'activity' == object )
     596            return false;
     597
     598        if ( null == scope )
     599            var scope = 'all';
    600600
    601601        if ( null == filter )
     
    615615
    616616        /* Save the type and filter to a session cookie */
    617         j.cookie( 'bp-' + id + '-type', type, null );
    618         j.cookie( 'bp-' + id + '-filter', filter, null );
    619         j.cookie( 'bp-' + id + '-page', page, null );
    620         j.cookie( 'bp-' + id + '-search-terms', search_terms, null );
     617        j.cookie( 'bp-' + object + '-scope', scope, null );
     618        j.cookie( 'bp-' + object + '-filter', filter, null );
     619        j.cookie( 'bp-' + object + '-page', page, null );
     620        j.cookie( 'bp-' + object + '-search-terms', search_terms, null );
    621621
    622622        /* Set the correct selected nav and filter */
     
    624624            j(this).removeClass('selected');
    625625        });
    626         j('div.item-list-tabs li#' + id + '-' + type + ', div.item-list-tabs#object-nav li.current').addClass('selected');
     626        j('div.item-list-tabs li#' + object + '-' + scope + ', div.item-list-tabs#object-nav li.current').addClass('selected');
    627627        j('div.item-list-tabs li.selected').addClass('loading');
    628628        j('div.item-list-tabs select option[value=' + filter + ']').attr( 'selected', 'selected' );
    629629
    630         if ( 'friends' == id )
    631             id = 'members';
     630        if ( 'friends' == object )
     631            object = 'members';
    632632
    633633        j.post( ajaxurl, {
    634             action: id + '_filter',
     634            action: object + '_filter',
    635635            'cookie': encodeURIComponent(document.cookie),
    636             'type': type,
     636            'object': object,
    637637            'filter': filter,
     638            'search_terms': search_terms,
     639            'scope': scope,
    638640            'page': page,
    639             'content': id,
    640             'search_terms': search_terms,
    641641            'extras': extras
    642642        },
     
    680680                var page_number = Number( j(target).html() );
    681681
    682             bp_filter_request( j.cookie('bp-' + object + '-type'), j.cookie('bp-' + object + '-filter'), object, 'div.' + object, page_number, j.cookie('bp-' + object + '-search-terms') );
     682            bp_filter_request( object, j.cookie('bp-' + object + '-filter'), j.cookie('bp-' + object + '-scope'), 'div.' + object, j.cookie('bp-' + object + '-search-terms'), page_number );
    683683
    684684            return false;
  • trunk/bp-themes/bp-default/blogs/blogs-loop.php

    r2284 r2422  
    1 <?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_content_filter() */ ?>
     1<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_object_filter() */ ?>
    22
    33<?php do_action( 'bp_before_blogs_loop' ) ?>
  • trunk/bp-themes/bp-default/groups/groups-loop.php

    r2284 r2422  
    1 <?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_content_filter() */ ?>
     1<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_object_filter() */ ?>
    22
    33<?php do_action( 'bp_before_groups_loop' ) ?>
  • trunk/bp-themes/bp-default/members/members-loop.php

    r2302 r2422  
    1 <?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_content_filter() */ ?>
     1<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_object_filter() */ ?>
    22
    33<?php do_action( 'bp_before_members_loop' ) ?>
Note: See TracChangeset for help on using the changeset viewer.