Changeset 3229
- Timestamp:
- 09/02/2010 06:14:02 PM (14 years ago)
- Location:
- branches/1.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.2/bp-groups.php
r3218 r3229 1909 1909 } 1910 1910 1911 /** 1912 * Is the specified user the creator of the group? 1913 * 1914 * @param int $user_id 1915 * @param int $group_id 1916 * @since 1.2.6 1917 * @uses BP_Groups_Member 1918 */ 1919 function groups_is_user_creator( $user_id, $group_id ) { 1920 return BP_Groups_Member::check_is_creator( $user_id, $group_id ); 1921 } 1922 1911 1923 /*** Group Activity Posting **************************************************/ 1912 1924 -
branches/1.2/bp-groups/bp-groups-classes.php
r3205 r3229 980 980 } 981 981 982 /** 983 * Is the specified user the creator of the group? 984 * 985 * @global object $bp BuddyPress global settings 986 * @global wpdb $wpdb WordPress database object 987 * @param int $user_id 988 * @param int $group_id 989 * @since 1.2.6 990 */ 991 function check_is_creator( $user_id, $group_id ) { 992 global $bp, $wpdb; 993 994 if ( !$user_id ) 995 return false; 996 997 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name} WHERE creator_id = %d AND id = %d", $user_id, $group_id ) ); 998 } 999 982 1000 function check_for_membership_request( $user_id, $group_id ) { 983 1001 global $wpdb, $bp; … … 1072 1090 } 1073 1091 1092 /** 1093 * Delete all group membership information for the specified user 1094 * 1095 * @global object $bp BuddyPress global settings 1096 * @global wpdb $wpdb WordPress database object 1097 * @param int $user_id 1098 * @since 1.0 1099 * @uses BP_Groups_Member 1100 */ 1074 1101 function delete_all_for_user( $user_id ) { 1075 global $ wpdb, $bp;1102 global $bp, $wpdb; 1076 1103 1077 1104 // Get all the group ids for the current user's groups and update counts … … 1079 1106 foreach ( $group_ids['groups'] as $group_id ) { 1080 1107 groups_update_groupmeta( $group_id, 'total_member_count', groups_get_total_member_count( $group_id ) - 1 ); 1108 1109 // If current user is the creator of a group and is the sole admin, delete that group to avoid counts going out-of-sync 1110 if ( groups_is_user_admin( $user_id, $group_id ) && count( groups_get_group_admins( $group_id ) ) < 2 && groups_is_user_creator( $user_id, $group_id ) ) 1111 groups_delete_group( $group_id ); 1081 1112 } 1082 1113
Note: See TracChangeset
for help on using the changeset viewer.