Ticket #5423: 5423.06.patch
| File 5423.06.patch, 9.9 KB (added by , 12 years ago) |
|---|
-
bp-groups/bp-groups-template.php
diff --git bp-groups/bp-groups-template.php bp-groups/bp-groups-template.php index a0f2e61..2d446be 100644
function bp_group_invite_user_remove_invite_url() { 3312 3312 return wp_nonce_url( site_url( bp_get_groups_slug() . '/' . $invites_template->invite->group_id . '/invites/remove/' . $invites_template->invite->user->id ), 'groups_invite_uninvite_user' ); 3313 3313 } 3314 3314 3315 /** 3316 * Output pagination links for group invitations. 3317 * 3318 * @since BuddyPress (2.0.0) 3319 */ 3320 function bp_group_invite_pagination_links() { 3321 echo bp_get_group_invite_pagination_links(); 3322 } 3323 /** 3324 * Get pagination links for group invitations. 3325 * 3326 * @since BuddyPress (2.0.0) 3327 */ 3328 function bp_get_group_invite_pagination_links() { 3329 global $invites_template; 3330 return apply_filters( 'bp_get_group_invite_pagination_links', $invites_template->pag_links ); 3331 } 3332 3333 /** 3334 * Output pagination count text for group invitations. 3335 * 3336 * @since BuddyPress (2.0.0) 3337 */ 3338 function bp_group_invite_pagination_count() { 3339 echo bp_get_group_invite_pagination_count(); 3340 } 3341 /** 3342 * Get pagination count text for group invitations. 3343 * 3344 * @since BuddyPress (2.0.0) 3345 */ 3346 function bp_get_group_invite_pagination_count() { 3347 global $invites_template; 3348 3349 $start_num = intval( ( $invites_template->pag_page - 1 ) * $invites_template->pag_num ) + 1; 3350 $from_num = bp_core_number_format( $start_num ); 3351 $to_num = bp_core_number_format( ( $start_num + ( $invites_template->pag_num - 1 ) > $invites_template->total_invite_count ) ? $invites_template->total_invite_count : $start_num + ( $invites_template->pag_num - 1 ) ); 3352 $total = bp_core_number_format( $invites_template->total_invite_count ); 3353 3354 return apply_filters( 'bp_get_groups_pagination_count', sprintf( _n( 'Viewing invitation %1$s to %2$s (of %3$s invitation)', 'Viewing invitation %1$s to %2$s (of %3$s invitations)', $total, 'buddypress' ), $from_num, $to_num, $total ), $from_num, $to_num, $total ); 3355 } 3356 3315 3357 /*** 3316 3358 * Groups RSS Feed Template Tags 3317 3359 */ -
bp-templates/bp-legacy/buddypress-functions.php
diff --git bp-templates/bp-legacy/buddypress-functions.php bp-templates/bp-legacy/buddypress-functions.php index d8963f5..93efcef 100644
class BP_Legacy extends BP_Theme_Compat { 139 139 'groups_filter' => 'bp_legacy_theme_object_template_loader', 140 140 'members_filter' => 'bp_legacy_theme_object_template_loader', 141 141 'messages_filter' => 'bp_legacy_theme_messages_template_loader', 142 'invite_filter' => 'bp_legacy_theme_invite_template_loader', 142 143 143 144 // Friends 144 145 'accept_friendship' => 'bp_legacy_theme_ajax_accept_friendship', … … function bp_legacy_theme_messages_template_loader() { 601 602 } 602 603 603 604 /** 605 * Load group invitations loop to handle pagination requests sent via AJAX. 606 * 607 * @since BuddyPress (2.0.0) 608 */ 609 function bp_legacy_theme_invite_template_loader() { 610 bp_get_template_part( 'groups/single/invites-loop' ); 611 exit(); 612 } 613 614 /** 604 615 * Load the activity loop template when activity is requested via AJAX, 605 616 * 606 617 * @return string JSON object containing 'contents' (output of the template loop -
bp-templates/bp-legacy/buddypress/groups/single/send-invites.php
diff --git bp-templates/bp-legacy/buddypress/groups/single/send-invites.php bp-templates/bp-legacy/buddypress/groups/single/send-invites.php index c2f0500..6f3d9ef 100644
2 2 3 3 <?php if ( bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?> 4 4 5 <?php /* 'send-invite-form' is important for AJAX support */ ?> 5 6 <form action="<?php bp_group_send_invite_form_action(); ?>" method="post" id="send-invite-form" class="standard-form" role="main"> 6 7 7 <div class=" left-menu">8 <div class="invite"> 8 9 9 <div id="invite-list"> 10 <ul> 11 <?php bp_new_group_invite_friend_list(); ?> 12 </ul> 10 <?php bp_get_template_part( 'groups/single/invites-loop' ); ?> 13 11 14 <?php wp_nonce_field( 'groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user' ); ?>15 </div>16 17 </div><!-- .left-menu -->18 19 <div class="main-column">20 21 <div id="message" class="info">22 <p><?php _e('Select people to invite from your friends list.', 'buddypress' ); ?></p>23 </div>24 25 <?php do_action( 'bp_before_group_send_invites_list' ); ?>26 27 <?php /* The ID 'friend-list' is important for AJAX support. */ ?>28 <ul id="friend-list" class="item-list">29 <?php if ( bp_group_has_invites() ) : ?>30 31 <?php while ( bp_group_invites() ) : bp_group_the_invite(); ?>32 33 <li id="<?php bp_group_invite_item_id(); ?>">34 <?php bp_group_invite_user_avatar(); ?>35 36 <h4><?php bp_group_invite_user_link(); ?></h4>37 <span class="activity"><?php bp_group_invite_user_last_active(); ?></span>38 39 <?php do_action( 'bp_group_send_invites_item' ); ?>40 41 <div class="action">42 <a class="button remove" href="<?php bp_group_invite_user_remove_invite_url(); ?>" id="<?php bp_group_invite_item_id(); ?>"><?php _e( 'Remove Invite', 'buddypress' ); ?></a>43 44 <?php do_action( 'bp_group_send_invites_item_action' ); ?>45 </div>46 </li>47 48 <?php endwhile; ?>49 50 <?php endif; ?>51 </ul><!-- #friend-list -->52 53 <?php do_action( 'bp_after_group_send_invites_list' ); ?>54 55 </div><!-- .main-column -->56 57 <div class="clear"></div>58 59 <div class="submit">60 <input type="submit" name="submit" id="submit" value="<?php esc_attr_e( 'Send Invites', 'buddypress' ); ?>" />61 12 </div> 62 13 63 <?php wp_nonce_field( 'groups_send_invites', '_wpnonce_send_invites' ); ?>64 65 14 <?php /* This is important, don't forget it */ ?> 66 15 <input type="hidden" name="group_id" id="group_id" value="<?php bp_group_id(); ?>" /> 67 16 68 17 </form><!-- #send-invite-form --> 69 18 70 <?php else : ?>71 72 <div id="message" class="info" role="main">73 <p><?php _e( 'Once you have built up friend connections you will be able to invite others to your group.', 'buddypress' ); ?></p>74 </div>75 76 19 <?php endif; ?> 77 20 78 21 <?php do_action( 'bp_after_group_send_invites_content' ); ?> -
bp-templates/bp-legacy/css/buddypress.css
diff --git bp-templates/bp-legacy/css/buddypress.css bp-templates/bp-legacy/css/buddypress.css index 6c13c70..feed445 100644
a.bp-title-button { 764 764 765 765 #buddypress form.standard-form .main-column ul#friend-list { 766 766 clear:none; 767 float: left; 767 768 } 768 769 769 770 #buddypress form.standard-form .main-column ul#friend-list h4 { … … a.bp-title-button { 1087 1088 background-color: #ffd; 1088 1089 border: 1px solid #cb2; 1089 1090 color: #440; 1090 1091 1091 1092 } 1092 1093 #buddypress div#item-header { 1093 1094 overflow: hidden; -
bp-templates/bp-legacy/js/buddypress.js
diff --git bp-templates/bp-legacy/js/buddypress.js bp-templates/bp-legacy/js/buddypress.js index 5dd91cc..943034b 100644
jq(document).ready( function() { 901 901 /** Invite Friends Interface ****************************************/ 902 902 903 903 /* Select a user from the list of friends and add them to the invite list */ 904 jq("#invite-list input").on( 'click', function() { 904 jq("#send-invite-form").on( 'click', '#invite-list input', function() { 905 // New template contains a div with the class of invite that's a first-level child of the form. Old template doesn't. 906 var invites_new_template = jq("#send-invite-form > invite").length; 907 905 908 jq('.ajax-loader').toggle(); 906 909 910 // Dim the form until the response arrives 911 if ( invites_new_template ) 912 jq( this ).parents( 'ul' ).find( 'input' ).prop( 'disabled', true ); 913 907 914 var friend_id = jq(this).val(); 908 915 909 916 if ( jq(this).prop('checked') == true ) … … jq(document).ready( function() { 911 918 else 912 919 var friend_action = 'uninvite'; 913 920 914 jq('.item-list-tabs li.selected').addClass('loading'); 921 if ( ! invites_new_template ) 922 jq('.item-list-tabs li.selected').addClass('loading'); 915 923 916 924 jq.post( ajaxurl, { 917 925 action: 'groups_invite_user', … … jq(document).ready( function() { 926 934 if ( jq("#message") ) 927 935 jq("#message").hide(); 928 936 929 jq('.ajax-loader').toggle(); 937 if ( invites_new_template ) { 938 // Refresh entire list (keeps pagination and totals up to date) 939 bp_filter_request( 'invite', 'bp-invite-filter', 'bp-invite-scope', 'div.invite', false, 1, '', '', '' ); 940 } else { 941 jq('.ajax-loader').toggle(); 930 942 931 if ( friend_action == 'invite' ) {932 jq('#friend-list').append(response);933 } else if ( friend_action == 'uninvite' ) {934 jq('#friend-list li#uid-' + friend_id).remove();935 }943 if ( friend_action == 'invite' ) { 944 jq('#friend-list').append(response); 945 } else if ( friend_action == 'uninvite' ) { 946 jq('#friend-list li#uid-' + friend_id).remove(); 947 } 936 948 937 jq('.item-list-tabs li.selected').removeClass('loading'); 949 jq('.item-list-tabs li.selected').removeClass('loading'); 950 } 938 951 }); 939 952 }); 940 953 941 954 /* Remove a user from the list of users to invite to a group */ 942 jq("#friend-list").on('click', 'li a.remove', function() { 955 jq("#send-invite-form").on('click', 'a.remove', function() { 956 // New template contains a div with the class of invite that's a first-level child of the form. Old template doesn't. 957 var invites_new_template = jq("#send-invite-form > invite").length; 958 943 959 jq('.ajax-loader').toggle(); 944 960 945 961 var friend_id = jq(this).attr('id'); … … jq(document).ready( function() { 956 972 }, 957 973 function(response) 958 974 { 959 jq('.ajax-loader').toggle(); 960 jq('#friend-list #uid-' + friend_id).remove(); 961 jq('#invite-list #f-' + friend_id).prop('checked', false); 975 if ( invites_new_template ) { 976 // Refresh entire list (keeps pagination and totals up to date) 977 bp_filter_request( 'invite', 'bp-invite-filter', 'bp-invite-scope', 'div.invite', false, 1, '', '', '' ); 978 } else { 979 jq('.ajax-loader').toggle(); 980 jq('#friend-list #uid-' + friend_id).remove(); 981 jq('#invite-list #f-' + friend_id).prop('checked', false); 982 } 962 983 }); 963 984 964 985 return false;