Ticket #7476: 7476.01.patch
File 7476.01.patch, 3.4 KB (added by , 7 years ago) |
---|
-
src/bp-groups/bp-groups-admin.php
1341 1341 } 1342 1342 } 1343 1343 add_action( bp_core_admin_hook(), 'bp_groups_admin_groups_type_change_notice' ); 1344 1345 /** 1346 * Add a notice to the "Delete Users" page. 1347 * 1348 * If the pending deleted user has created some groups, add a warning prompt. 1349 * 1350 * @since 2.9.0 1351 */ 1352 function bp_groups_admin_add_delete_user_prompt() { 1353 $groups = groups_get_groups( array( 1354 'creator_id' => (int) $_GET['user'], 1355 'per_page' => 1, 1356 'show_hidden' => true 1357 ) ); 1358 1359 if ( ! empty( $groups['total'] ) ) { 1360 printf( '<p>%s</p>', esc_html__( 'This user has created some BuddyPress groups. Deleting this user will also remove these groups. Are you sure you want to delete this user?', 'buddypress' ) ); 1361 } 1362 } 1363 add_action( 'delete_user_form', 'bp_groups_admin_add_delete_user_prompt' ); -
src/bp-groups/bp-groups-functions.php
689 689 * @since 1.2.0 690 690 * @since 2.6.0 Added `$group_type`, `$group_type__in`, and `$group_type__not_in` parameters. 691 691 * @since 2.7.0 Added `$update_admin_cache` and `$parent_id` parameters. 692 * @since 2.9.0 Added `$creator_id` parameter. 692 693 * 693 694 * @param array|string $args { 694 695 * Array of arguments. Supports all arguments of … … 722 723 'page' => 1, // The page to return if limiting per page. 723 724 'update_meta_cache' => true, // Pre-fetch groupmeta for queried groups. 724 725 'update_admin_cache' => false, 726 'creator_id' => null 725 727 ); 726 728 727 729 $r = bp_parse_args( $args, $defaults, 'groups_get_groups' ); … … 747 749 'update_admin_cache' => $r['update_admin_cache'], 748 750 'order' => $r['order'], 749 751 'orderby' => $r['orderby'], 752 'creator_id' => $r['creator_id'] 750 753 ) ); 751 754 752 755 /** -
src/bp-groups/classes/class-bp-groups-group.php
923 923 * @type array|string $status Optional. Array or comma-separated list of group statuses to limit 924 924 * results to. If specified, $show_hidden is ignored. 925 925 * Default: empty array. 926 * @type array|string $creator_id Optional. Array or comma-separated list of user IDs that created a group. 927 * Default: null. 926 928 * } 927 929 * @return array { 928 930 * @type array $groups Array of group objects returned by the … … 973 975 'update_admin_cache' => false, 974 976 'exclude' => false, 975 977 'show_hidden' => false, 976 'status' => array() 978 'status' => array(), 979 'creator_id' => null 977 980 ); 978 981 979 982 $r = wp_parse_args( $args, $defaults ); … … 1099 1102 $where_conditions['exclude'] = "g.id NOT IN ({$exclude})"; 1100 1103 } 1101 1104 1105 if ( ! is_null( $r['creator_id'] ) ) { 1106 $creator_id = implode( ',', wp_parse_id_list( $r['creator_id'] ) ); 1107 $where_conditions['creator_id'] = "g.creator_id IN ({$creator_id})"; 1108 } 1109 1102 1110 /* Order/orderby ********************************************/ 1103 1111 1104 1112 $order = $r['order'];