Changeset 11604 for trunk/src/bp-groups/classes/class-bp-groups-group.php
- Timestamp:
- 06/21/2017 10:37:23 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/classes/class-bp-groups-group.php
r11558 r11604 753 753 * 754 754 * @since 1.6.0 755 * 756 * @param int $user_id ID of the inviting user. 757 * @param int $group_id ID of the group. 758 * @return array IDs of users who have been invited to the group by the 759 * user but have not yet accepted. 760 */ 761 public static function get_invites( $user_id, $group_id ) { 755 * @since 2.9.0 Added $sent as a parameter. 756 * 757 * @param int $user_id ID of the inviting user. 758 * @param int $group_id ID of the group. 759 * @param int|null $sent Query for a specific invite sent status. If 0, this will query for users 760 * that haven't had an invite sent to them yet. If 1, this will query for 761 * users that have had an invite sent to them. If null, no invite status will 762 * queried. Default: null. 763 * @return array IDs of users who have been invited to the group by the user but have not 764 * yet accepted. 765 */ 766 public static function get_invites( $user_id, $group_id, $sent = null ) { 762 767 global $wpdb; 763 768 764 $bp = buddypress(); 765 766 return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d and is_confirmed = 0 AND inviter_id = %d", $group_id, $user_id ) ); 769 $bp = buddypress(); 770 $sql = $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d and is_confirmed = 0 AND inviter_id = %d", $group_id, $user_id ); 771 772 // Query for a specific invite sent status. 773 if ( ! is_null( $sent ) ) { 774 $sql .= $wpdb->prepare( ' AND invite_sent = %d', $sent ); 775 } 776 777 return $wpdb->get_col( $sql ); 767 778 } 768 779
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)