Ticket #921: 921.05.template.diff
File 921.05.template.diff, 12.2 KB (added by , 11 years ago) |
---|
-
bp-groups/bp-groups-template.php
diff --git bp-groups/bp-groups-template.php bp-groups/bp-groups-template.php index 6850194..e755670 100644
class BP_Groups_Group_Members_Template { 1991 1991 $this->pag_page = isset( $_REQUEST['mlpage'] ) ? intval( $_REQUEST['mlpage'] ) : $r['page']; 1992 1992 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 1993 1993 1994 /** 1995 * In themes, If 'groups/single/home' template has been updated 1996 * but not 'groups/single/members', it prevents the pagination 1997 * url to be messed up with admin-ajax. 1998 */ 1999 $base_url = trailingslashit( bp_get_group_permalink( groups_get_current_group() ) . bp_current_action() ); 2000 2001 if ( bp_action_variable() ) { 2002 $base_url = trailingslashit( $base_url . bp_action_variable() ); 2003 } 2004 1994 2005 $members_args = $r; 1995 2006 1996 2007 $members_args['page'] = $this->pag_page; … … class BP_Groups_Group_Members_Template { 2015 2026 } 2016 2027 2017 2028 $this->pag_links = paginate_links( array( 2018 'base' => add_query_arg( 'mlpage', '%#%'),2029 'base' => add_query_arg( array( 'mlpage' => '%#%' ), $base_url ), 2019 2030 'format' => '', 2020 2031 'total' => !empty( $this->pag_num ) ? ceil( $this->total_member_count / $this->pag_num ) : $this->total_member_count, 2021 2032 'current' => $this->pag_page, … … class BP_Groups_Group_Members_Template { 2095 2106 function bp_group_has_members( $args = '' ) { 2096 2107 global $members_template; 2097 2108 2109 $exclude_admins_mods = 1; 2110 2111 if ( bp_is_group_members() ) { 2112 $exclude_admins_mods = 0; 2113 } 2114 2098 2115 $r = wp_parse_args( $args, array( 2099 2116 'group_id' => bp_get_current_group_id(), 2100 2117 'page' => 1, 2101 2118 'per_page' => 20, 2102 2119 'max' => false, 2103 2120 'exclude' => false, 2104 'exclude_admins_mods' => 1,2121 'exclude_admins_mods' => $exclude_admins_mods, 2105 2122 'exclude_banned' => 1, 2106 2123 'group_role' => false, 2107 2124 'search_terms' => false, … … function bp_group_member_admin_pagination() { 2287 2304 return $members_template->pag_links; 2288 2305 } 2289 2306 2307 /** 2308 * Output the Group members template 2309 * 2310 * @since BuddyPress (?) 2311 * 2312 * @return string html output 2313 */ 2314 function bp_groups_members_template_part() { 2315 ?> 2316 <div class="item-list-tabs" id="subnav" role="navigation"> 2317 <ul> 2318 <li class="groups-members-search" role="search"> 2319 <?php bp_directory_members_search_form(); ?> 2320 </li> 2321 2322 <?php bp_groups_members_filter(); ?> 2323 <?php do_action( 'bp_members_directory_member_sub_types' ); ?> 2324 2325 </ul> 2326 </div> 2327 2328 <div id="members-group-list" class="group_members dir-list"> 2329 2330 <?php bp_get_template_part( 'groups/single/members' ); ?> 2331 2332 </div> 2333 <?php 2334 } 2335 2336 /** 2337 * Output the Group members filters 2338 * 2339 * @since BuddyPress (?) 2340 * 2341 * @return string html output 2342 */ 2343 function bp_groups_members_filter() { 2344 ?> 2345 <li id="group_members-order-select" class="last filter"> 2346 <label for="group_members-order-by"><?php _e( 'Order By:', 'buddypress' ); ?></label> 2347 <select id="group_members-order-by"> 2348 <option value="last_joined"><?php _e( 'Newest', 'buddypress' ); ?></option> 2349 <option value="first_joined"><?php _e( 'Oldest', 'buddypress' ); ?></option> 2350 <option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ); ?></option> 2351 2352 <?php do_action( 'bp_groups_members_order_options' ); ?> 2353 2354 </select> 2355 </li> 2356 <?php 2357 } 2290 2358 2291 2359 /*************************************************************************** 2292 2360 * 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..2f15976 100644
function bp_legacy_theme_object_template_loader() { 541 541 if ( ! bp_current_action() ) 542 542 bp_update_is_directory( true, bp_current_component() ); 543 543 544 $template_part = $object . '/' . $object . '-loop'; 545 546 if ( ! empty( $_POST['template'] ) ) 547 $template_part = sanitize_option( 'upload_path', $_POST['template'] ); 548 544 549 // Locate the object template 545 bp_get_template_part( "$object/$object-loop");550 bp_get_template_part( $template_part ); 546 551 exit(); 547 552 } 548 553 -
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 {