Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/01/2018 10:11:35 PM (6 years ago)
Author:
r-a-y
Message:

Groups: Move some functions from bp-groups-actions.php to bp-groups-functions.php

Some of the functions from bp-groups-actions.php are not related to group
page actions, so these are being moved to the all-purpose
bp-groups-functions.php file.

The intent is to remove and split up the bp-groups-actions.php and
bp-groups-screens.php files until these functions are actually
needed.

See #7218.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-actions.php

    r11776 r11922  
    1414// Exit if accessed directly.
    1515defined( 'ABSPATH' ) || exit;
    16 
    17 /**
    18  * Fire the 'bp_groups_register_group_types' action.
    19  *
    20  * @since 2.6.0
    21  */
    22 function bp_groups_register_group_types() {
    23     /**
    24      * Fires when it's appropriate to register group types.
    25      *
    26      * @since 2.6.0
    27      */
    28     do_action( 'bp_groups_register_group_types' );
    29 }
    30 add_action( 'bp_register_taxonomies', 'bp_groups_register_group_types' );
    3116
    3217/**
     
    593578}
    594579add_action( 'bp_actions', 'groups_action_group_feed' );
    595 
    596 /**
    597  * Update orphaned child groups when the parent is deleted.
    598  *
    599  * @since 2.7.0
    600  *
    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.