Changeset 11922 for trunk/src/bp-groups/bp-groups-actions.php
- Timestamp:
- 04/01/2018 10:11:35 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-actions.php
r11776 r11922 14 14 // Exit if accessed directly. 15 15 defined( 'ABSPATH' ) || exit; 16 17 /**18 * Fire the 'bp_groups_register_group_types' action.19 *20 * @since 2.6.021 */22 function bp_groups_register_group_types() {23 /**24 * Fires when it's appropriate to register group types.25 *26 * @since 2.6.027 */28 do_action( 'bp_groups_register_group_types' );29 }30 add_action( 'bp_register_taxonomies', 'bp_groups_register_group_types' );31 16 32 17 /** … … 593 578 } 594 579 add_action( 'bp_actions', 'groups_action_group_feed' ); 595 596 /**597 * Update orphaned child groups when the parent is deleted.598 *599 * @since 2.7.0600 *601 * @param BP_Groups_Group $group Instance of the group item being deleted.602 */603 function bp_groups_update_orphaned_groups_on_group_delete( $group ) {604 // Get child groups and set the parent to the deleted parent's parent.605 $grandparent_group_id = $group->parent_id;606 $child_args = array(607 'parent_id' => $group->id,608 'show_hidden' => true,609 'per_page' => false,610 'update_meta_cache' => false,611 );612 $children = groups_get_groups( $child_args );613 $children = $children['groups'];614 615 foreach ( $children as $cgroup ) {616 $cgroup->parent_id = $grandparent_group_id;617 $cgroup->save();618 }619 }620 add_action( 'bp_groups_delete_group', 'bp_groups_update_orphaned_groups_on_group_delete', 10, 2 );
Note: See TracChangeset
for help on using the changeset viewer.