Changeset 4324
- Timestamp:
- 05/02/2011 08:55:26 PM (14 years ago)
- Location:
- trunk/bp-groups
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-classes.php
r4211 r4324 889 889 } 890 890 891 function check_has_invite( $user_id, $group_id ) {891 function check_has_invite( $user_id, $group_id, $type = 'sent' ) { 892 892 global $wpdb, $bp; 893 893 894 894 if ( !$user_id ) 895 895 return false; 896 897 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0 AND invite_sent = 1", $user_id, $group_id ) ); 896 897 $sql = "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 0 AND inviter_id != 0"; 898 899 if ( 'sent' == $type ) 900 $sql .= " AND invite_sent = 1"; 901 902 return $wpdb->get_var( $wpdb->prepare( $sql, $user_id, $group_id ) ); 898 903 } 899 904 -
trunk/bp-groups/bp-groups-functions.php
r4230 r4324 525 525 return false; 526 526 527 if ( !groups_is_user_member( $user_id, $group_id ) && !groups_check_user_has_invite( $user_id, $group_id ) ) {527 if ( !groups_is_user_member( $user_id, $group_id ) && !groups_check_user_has_invite( $user_id, $group_id, 'all' ) ) { 528 528 $invite = new BP_Groups_Member; 529 529 $invite->group_id = $group_id; … … 628 628 } 629 629 630 function groups_check_user_has_invite( $user_id, $group_id ) { 631 return BP_Groups_Member::check_has_invite( $user_id, $group_id ); 630 /** 631 * Check to see whether a user has already been invited to a group 632 * 633 * By default, the function checks for invitations that have been sent. Entering 'all' as the $type 634 * parameter will return unsent invitations as well (useful to make sure AJAX requests are not 635 * duplicated) 636 * 637 * @package BuddyPress Groups 638 * 639 * @param int $user_id Potential group member 640 * @param int $group_id Potential group 641 * @param str $type Optional. Use 'sent' to check for sent invites, 'all' to check for all 642 * @return bool Returns true if an invitation is found 643 */ 644 function groups_check_user_has_invite( $user_id, $group_id, $type = 'sent' ) { 645 return BP_Groups_Member::check_has_invite( $user_id, $group_id, $type ); 632 646 } 633 647 -
trunk/bp-groups/bp-groups-notifications.php
r4144 r4324 245 245 246 246 wp_mail( $to, $subject, $message ); 247 }248 249 do_action( 'bp_groups_sent_invited_email', $invited_user_id, $subject, $message, $group );247 248 do_action( 'bp_groups_sent_invited_email', $invited_user_id, $subject, $message, $group ); 249 } 250 250 } 251 251 -
trunk/bp-groups/bp-groups-screens.php
r4317 r4324 381 381 if ( !check_admin_referer( 'groups_send_invites', '_wpnonce_send_invites' ) ) 382 382 return false; 383 384 if ( !empty( $_POST['friends'] ) ) { 385 foreach( (array)$_POST['friends'] as $friend ) { 386 groups_invite_user( array( 'user_id' => $friend, 'group_id' => $bp->groups->current_group->id ) ); 387 } 388 } 383 389 384 390 // Send the invites.
Note: See TracChangeset
for help on using the changeset viewer.