Ticket #921: 921.03.diff
File 921.03.diff, 13.8 KB (added by , 11 years ago) |
---|
-
bp-groups/bp-groups-classes.php
diff --git bp-groups/bp-groups-classes.php bp-groups/bp-groups-classes.php index 2ed7441..bed0eb7 100644
class BP_Group_Member_Query extends BP_User_Query { 1460 1460 'group_id' => 0, 1461 1461 'group_role' => array( 'member' ), 1462 1462 'is_confirmed' => true, 1463 'type' => 'last_modified', 1463 1464 ) ); 1464 1465 1465 1466 $group_member_ids = $this->get_group_member_ids(); … … class BP_Group_Member_Query extends BP_User_Query { 1562 1563 1563 1564 /** ORDER BY clause ***************************************************/ 1564 1565 1565 // @todo For now, mimicking legacy behavior of 1566 // bp_group_has_members(), which has us order by date_modified 1567 // only. Should abstract it in the future 1566 /** 1567 * The order for alphabetical type will be set in 1568 * BP_Group_Member_Query->set_orderby() In the group members 1569 * table, date_modified is the 'sortable' field available. 1570 * The two remaining types, last_modified and first_modified, 1571 * are managed here. 1572 */ 1573 1574 if ( isset( $this->query_vars['type'] ) ) { 1575 $type = $this->query_vars['type']; 1576 } else { 1577 $type = 'last_modified'; 1578 } 1579 1568 1580 $sql['orderby'] = "ORDER BY date_modified"; 1569 1581 $sql['order'] = "DESC"; 1570 1582 1583 if ( 'first_modified' == $type ) { 1584 $sql['order'] = "ASC"; 1585 } 1586 1571 1587 /** LIMIT clause ******************************************************/ 1572 1588 $this->group_member_ids = $wpdb->get_col( "{$sql['select']} {$sql['where']} {$sql['orderby']} {$sql['order']} {$sql['limit']}" ); 1573 1589 1574 return $this->group_member_ids; 1590 /** 1591 * You can filter the group member ids from here to build your custom query 1592 * if you defined a custom type using the action 'bp_groups_members_order_options' 1593 * for instance 1594 */ 1595 return apply_filters( 'bp_group_member_query_group_member_ids', $this->group_member_ids, $type, $this->query_vars['group_id'] ); 1575 1596 } 1576 1597 1577 1598 /** … … class BP_Group_Member_Query extends BP_User_Query { 1583 1604 * @param BP_User_Query $query BP_User_Query object. 1584 1605 */ 1585 1606 public function set_orderby( $query ) { 1586 $gm_ids = $this->get_group_member_ids(); 1607 1608 $gm_ids = $this->get_group_member_ids( $query->query_vars['type'] ); 1609 1587 1610 if ( empty( $gm_ids ) ) { 1588 1611 $gm_ids = array( 0 ); 1589 1612 } 1590 1613 1591 // The first param in the FIELD() clause is the sort column id 1592 $gm_ids = array_merge( array( 'u.id' ), wp_parse_id_list( $gm_ids ) ); 1593 $gm_ids_sql = implode( ',', $gm_ids ); 1614 // No need to change the order of BP_User_Query in case type is alphabetical 1615 if ( 'alphabetical' != $query->query_vars['type'] ) { 1616 // The first param in the FIELD() clause is the sort column id 1617 $gm_ids = array_merge( array( 'u.id' ), wp_parse_id_list( $gm_ids ) ); 1618 $gm_ids_sql = implode( ',', $gm_ids ); 1594 1619 1595 $query->uid_clauses['orderby'] = "ORDER BY FIELD(" . $gm_ids_sql . ")"; 1620 $query->uid_clauses['orderby'] = "ORDER BY FIELD(" . $gm_ids_sql . ")"; 1621 } 1596 1622 1597 1623 // Prevent this filter from running on future BP_User_Query 1598 1624 // instances on the same page -
bp-groups/bp-groups-template.php
diff --git bp-groups/bp-groups-template.php bp-groups/bp-groups-template.php index 675409e..466cef9 100644
function bp_group_member_admin_pagination() { 2282 2282 return $members_template->pag_links; 2283 2283 } 2284 2284 2285 /** 2286 * Output the Group members template 2287 * 2288 * @since BuddyPress (?) 2289 * 2290 * @return string html output 2291 */ 2292 function bp_groups_members_template_part() { 2293 ?> 2294 <div class="item-list-tabs" id="subnav" role="navigation"> 2295 <ul> 2296 <li class="groups-members-search" role="search"> 2297 <?php bp_directory_members_search_form(); ?> 2298 </li> 2299 2300 <?php bp_groups_members_filter(); ?> 2301 <?php do_action( 'bp_members_directory_member_sub_types' ); ?> 2302 2303 </ul> 2304 </div> 2305 2306 <div id="members-group-list" class="group_members dir-list"> 2307 2308 <?php bp_get_template_part( 'groups/single/members' ); ?> 2309 2310 </div> 2311 <?php 2312 } 2313 2314 /** 2315 * Output the Group members filters 2316 * 2317 * @since BuddyPress (?) 2318 * 2319 * @return string html output 2320 */ 2321 function bp_groups_members_filter() { 2322 ?> 2323 <li id="group_members-order-select" class="last filter"> 2324 <label for="group_members-order-by"><?php _e( 'Order By:', 'buddypress' ); ?></label> 2325 <select id="group_members-order-by"> 2326 <option value="last_modified"><?php _e( 'Newest', 'buddypress' ); ?></option> 2327 <option value="first_modified"><?php _e( 'Oldest', 'buddypress' ); ?></option> 2328 <option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ); ?></option> 2329 2330 <?php do_action( 'bp_groups_members_order_options' ); ?> 2331 2332 </select> 2333 </li> 2334 <?php 2335 } 2285 2336 2286 2337 /*************************************************************************** 2287 2338 * Group Creation Process Template Tags -
bp-templates/bp-legacy/buddypress-functions.php
diff --git bp-templates/bp-legacy/buddypress-functions.php bp-templates/bp-legacy/buddypress-functions.php index 0cb3153..eeddc24 100644
function bp_legacy_theme_ajax_querystring( $query_string, $object ) { 448 448 449 449 $qs = array(); 450 450 451 /* Single Group Members specific case */ 452 if ( bp_is_group_members() ) { 453 $object = 'group_members'; 454 $qs[] = 'exclude_admins_mods=0'; 455 } 456 451 457 /** 452 458 * Check if any cookie values are set. If there are then override the 453 459 * default params passed to the template loop. … … function bp_legacy_theme_object_template_loader() { 541 547 if ( ! bp_current_action() ) 542 548 bp_update_is_directory( true, bp_current_component() ); 543 549 550 $template_part = $object . '/' . $object . '-loop'; 551 552 if ( ! empty( $_POST['template'] ) ) 553 $template_part = sanitize_option( 'upload_path', $_POST['template'] ); 554 544 555 // Locate the object template 545 bp_get_template_part( "$object/$object-loop");556 bp_get_template_part( $template_part ); 546 557 exit(); 547 558 } 548 559 -
bp-templates/bp-legacy/buddypress/groups/single/home.php
diff --git bp-templates/bp-legacy/buddypress/groups/single/home.php bp-templates/bp-legacy/buddypress/groups/single/home.php index 55dd5b0..8499866 100644
47 47 elseif ( bp_is_active( 'activity' ) ) : bp_get_template_part( 'groups/single/activity' ); 48 48 49 49 // Otherwise show members 50 elseif ( bp_is_active( 'members' ) ) : bp_g et_template_part( 'groups/single/members');50 elseif ( bp_is_active( 'members' ) ) : bp_groups_members_template_part(); 51 51 52 52 endif; 53 53 … … 61 61 elseif ( bp_is_group_activity() ) : bp_get_template_part( 'groups/single/activity' ); 62 62 63 63 // Group Members 64 elseif ( bp_is_group_members() ) : bp_g et_template_part( 'groups/single/members');64 elseif ( bp_is_group_members() ) : bp_groups_members_template_part(); 65 65 66 66 // Group Invitations 67 67 elseif ( bp_is_group_invites() ) : bp_get_template_part( 'groups/single/send-invites' ); -
bp-templates/bp-legacy/buddypress/groups/single/members.php
diff --git bp-templates/bp-legacy/buddypress/groups/single/members.php bp-templates/bp-legacy/buddypress/groups/single/members.php index fb7b4e2..f1714a5 100644
1 <?php if ( bp_group_has_members( 'exclude_admins_mods=0') ) : ?>1 <?php if ( bp_group_has_members( bp_ajax_querystring( 'group_members' ) ) ) : ?> 2 2 3 3 <?php do_action( 'bp_before_group_members_content' ); ?> 4 4 5 <div class="item-list-tabs" id="subnav" role="navigation"> 6 <ul> 7 8 <?php do_action( 'bp_members_directory_member_sub_types' ); ?> 9 10 </ul> 11 </div> 12 13 <div id="pag-top" class="pagination no-ajax"> 5 <div id="pag-top" class="pagination"> 14 6 15 7 <div class="pag-count" id="member-count-top"> 16 8 … … 63 55 64 56 <?php do_action( 'bp_after_group_members_list' ); ?> 65 57 66 <div id="pag-bottom" class="pagination no-ajax">58 <div id="pag-bottom" class="pagination"> 67 59 68 60 <div class="pag-count" id="member-count-bottom"> 69 61 -
bp-templates/bp-legacy/css/buddypress.css
diff --git bp-templates/bp-legacy/css/buddypress.css bp-templates/bp-legacy/css/buddypress.css index 81dd03f..995d650 100644
body.activity-permalink #buddypress div.activity-comments div.acomment-content { 486 486 float: right; 487 487 margin: -39px 0 0 0; 488 488 } 489 #buddypress div.dir-search input[type=text] { 489 #buddypress div.dir-search input[type=text], 490 #buddypress li.groups-members-search input[type=text] { 490 491 font-size: 90%; 491 492 padding: 1px 3px; 492 493 } … … body.activity-permalink #buddypress div.activity-comments div.acomment-content { 581 582 #buddypress .standard-form select, 582 583 #buddypress .standard-form input[type=password], 583 584 #buddypress .dir-search input[type=search], 584 #buddypress .dir-search input[type=text] { 585 #buddypress .dir-search input[type=text], 586 #buddypress .groups-members-search input[type=search], 587 #buddypress .groups-members-search input[type=text] { 585 588 border: 1px solid #ccc; 586 589 background: #fafafa; 587 590 border-radius: 0; -
bp-templates/bp-legacy/js/buddypress.js
diff --git bp-templates/bp-legacy/js/buddypress.js bp-templates/bp-legacy/js/buddypress.js index 350193e..562c734 100644
jq(document).ready( function() { 17 17 bp_init_activity(); 18 18 19 19 /* Object filter and scope set. */ 20 var objects = [ 'members', 'groups', 'blogs', 'forums' ];20 var objects = [ 'members', 'groups', 'blogs', 'forums', 'group_members' ]; 21 21 bp_init_objects( objects ); 22 22 23 23 /* @mention Compose Scrolling */ … … jq(document).ready( function() { 663 663 /**** Directory Search ****************************************************/ 664 664 665 665 /* The search form on all directory pages */ 666 jq('.dir-search ').on( 'click', function(event) {666 jq('.dir-search, .groups-members-search').on( 'click', function(event) { 667 667 if ( jq(this).hasClass('no-ajax') ) 668 668 return; 669 669 … … jq(document).ready( function() { 673 673 var css_id = jq('.item-list-tabs li.selected').attr('id').split( '-' ); 674 674 var object = css_id[0]; 675 675 676 bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope') , 'div.' + object, target.parent().children('label').children('input').val(), 1, jq.cookie('bp-' + object + '-extras') ); 676 if ( 'members' == object && 'groups' == css_id[1] ) { 677 object = 'group_members'; 678 var template = 'groups/single/members'; 679 } else { 680 var template = null; 681 } 682 683 bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope') , 'div.' + object, target.parent().children('label').children('input').val(), 1, jq.cookie('bp-' + object + '-extras'), null, template ); 677 684 678 685 return false; 679 686 } … … jq(document).ready( function() { 721 728 if ( jq('.dir-search input').length ) 722 729 search_terms = jq('.dir-search input').val(); 723 730 731 if ( jq( '.groups-members-search input' ).length ) 732 search_terms = jq( '.groups-members-search input' ).val(); 733 734 if ( 'members' == object && 'groups' == scope ) { 735 object = 'group_members'; 736 var template = 'groups/single/members'; 737 } else { 738 var template = null; 739 } 740 724 741 if ( 'friends' == object ) 725 742 object = 'members'; 726 743 727 bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras') );744 bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras'), null, template ); 728 745 729 746 return false; 730 747 }); … … jq(document).ready( function() { 754 771 if ( jq('div.dir-search input').length ) 755 772 search_terms = jq('.dir-search input').val(); 756 773 774 if ( jq( '.groups-members-search input' ).length ) 775 search_terms = jq( '.groups-members-search input' ).val(); 776 777 if ( 'members' == object && 'groups' == css_id[1] ) { 778 var object = 'group_members'; 779 var template = 'groups/single/members'; 780 } else { 781 var template = null; 782 } 783 757 784 if ( jq(target).hasClass('next') ) 758 785 var page_number = Number( jq('.pagination span.current').html() ) + 1; 759 786 else if ( jq(target).hasClass('prev') ) … … jq(document).ready( function() { 767 794 var caller = null; 768 795 } 769 796 770 bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope'), 'div.' + object, search_terms, page_number, jq.cookie('bp-' + object + '-extras'), caller );797 bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope'), 'div.' + object, search_terms, page_number, jq.cookie('bp-' + object + '-extras'), caller, template ); 771 798 772 799 return false; 773 800 } … … jq(document).ready( function() { 966 993 }); 967 994 968 995 /* Add / Remove friendship buttons */ 969 jq( '#members-dir-list').on('click', '.friendship-button a', function() {996 jq( '#members-dir-list, #members-group-list' ).on('click', '.friendship-button a', function() { 970 997 jq(this).parent().addClass('loading'); 971 998 var fid = jq(this).attr('id'); 972 999 fid = fid.split('-'); … … function bp_init_objects(objects) { 1383 1410 } 1384 1411 1385 1412 /* Filter the current content list (groups/members/blogs/topics) */ 1386 function bp_filter_request( object, filter, scope, target, search_terms, page, extras, caller ) {1413 function bp_filter_request( object, filter, scope, target, search_terms, page, extras, caller, template ) { 1387 1414 if ( 'activity' == object ) 1388 1415 return false; 1389 1416 … … function bp_filter_request( object, filter, scope, target, search_terms, page, e 1412 1439 jq('.item-list-tabs li.selected').addClass('loading'); 1413 1440 jq('.item-list-tabs select option[value="' + filter + '"]').prop( 'selected', true ); 1414 1441 1415 if ( 'friends' == object )1442 if ( 'friends' == object || 'group_members' == object ) { 1416 1443 object = 'members'; 1444 } 1417 1445 1418 1446 if ( bp_ajax_request ) 1419 1447 bp_ajax_request.abort(); … … function bp_filter_request( object, filter, scope, target, search_terms, page, e 1426 1454 'search_terms': search_terms, 1427 1455 'scope': scope, 1428 1456 'page': page, 1429 'extras': extras 1457 'extras': extras, 1458 'template':template 1430 1459 }, 1431 1460 function(response) 1432 1461 {