[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * BuddyPress Groups Actions. 4 * 5 * Action functions are exactly the same as screen functions, however they do 6 * not have a template screen associated with them. Usually they will send the 7 * user back to the default screen after execution. 8 * 9 * @package BuddyPress 10 * @subpackage GroupsActions 11 * @since 1.5.0 12 */ 13 14 // Exit if accessed directly. 15 defined( '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' ); 31 32 /** 33 * Protect access to single groups. 34 * 35 * @since 2.1.0 36 */ 37 function bp_groups_group_access_protection() { 38 if ( ! bp_is_group() ) { 39 return; 40 } 41 42 $current_group = groups_get_current_group(); 43 $user_has_access = $current_group->user_has_access; 44 $is_visible = $current_group->is_visible; 45 $no_access_args = array(); 46 47 // The user can know about the group but doesn't have full access. 48 if ( ! $user_has_access && $is_visible ) { 49 // Always allow access to home and request-membership. 50 if ( bp_is_current_action( 'home' ) || bp_is_current_action( 'request-membership' ) ) { 51 $user_has_access = true; 52 53 // User doesn't have access, so set up redirect args. 54 } elseif ( is_user_logged_in() ) { 55 $no_access_args = array( 56 'message' => __( 'You do not have access to this group.', 'buddypress' ), 57 'root' => bp_get_group_permalink( $current_group ) . 'home/', 58 'redirect' => false 59 ); 60 } 61 } 62 63 // Protect the admin tab from non-admins. 64 if ( bp_is_current_action( 'admin' ) && ! bp_is_item_admin() ) { 65 $user_has_access = false; 66 $no_access_args = array( 67 'message' => __( 'You are not an admin of this group.', 'buddypress' ), 68 'root' => bp_get_group_permalink( $current_group ), 69 'redirect' => false 70 ); 71 } 72 73 /** 74 * Allow plugins to filter whether the current user has access to this group content. 75 * 76 * Note that if a plugin sets $user_has_access to false, it may also 77 * want to change the $no_access_args, to avoid problems such as 78 * logged-in users being redirected to wp-login.php. 79 * 80 * @since 2.1.0 81 * 82 * @param bool $user_has_access True if the user has access to the 83 * content, otherwise false. 84 * @param array $no_access_args Arguments to be passed to bp_core_no_access() in case 85 * of no access. Note that this value is passed by reference, 86 * so it can be modified by the filter callback. 87 */ 88 $user_has_access = apply_filters_ref_array( 'bp_group_user_has_access', array( $user_has_access, &$no_access_args ) ); 89 90 // If user has access, we return rather than redirect. 91 if ( $user_has_access ) { 92 return; 93 } 94 95 // Groups that the user cannot know about should return a 404 for non-members. 96 // Unset the current group so that you're not redirected 97 // to the default group tab. 98 if ( ! $is_visible ) { 99 buddypress()->groups->current_group = 0; 100 buddypress()->is_single_item = false; 101 bp_do_404(); 102 return; 103 } else { 104 bp_core_no_access( $no_access_args ); 105 } 106 107 } 108 add_action( 'bp_actions', 'bp_groups_group_access_protection' ); 109 110 /** 111 * Catch and process group creation form submissions. 112 * 113 * @since 1.2.0 114 * 115 * @return bool 116 */ 117 function groups_action_create_group() { 118 119 // If we're not at domain.org/groups/create/ then return false. 120 if ( !bp_is_groups_component() || !bp_is_current_action( 'create' ) ) 121 return false; 122 123 if ( !is_user_logged_in() ) 124 return false; 125 126 if ( !bp_user_can_create_groups() ) { 127 bp_core_add_message( __( 'Sorry, you are not allowed to create groups.', 'buddypress' ), 'error' ); 128 bp_core_redirect( bp_get_groups_directory_permalink() ); 129 } 130 131 $bp = buddypress(); 132 133 // Make sure creation steps are in the right order. 134 groups_action_sort_creation_steps(); 135 136 // If no current step is set, reset everything so we can start a fresh group creation. 137 $bp->groups->current_create_step = bp_action_variable( 1 ); 138 if ( !bp_get_groups_current_create_step() ) { 139 unset( $bp->groups->current_create_step ); 140 unset( $bp->groups->completed_create_steps ); 141 142 setcookie( 'bp_new_group_id', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() ); 143 setcookie( 'bp_completed_create_steps', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() ); 144 145 $reset_steps = true; 146 $keys = array_keys( $bp->groups->group_creation_steps ); 147 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . array_shift( $keys ) ) ); 148 } 149 150 // If this is a creation step that is not recognized, just redirect them back to the first screen. 151 if ( bp_get_groups_current_create_step() && empty( $bp->groups->group_creation_steps[bp_get_groups_current_create_step()] ) ) { 152 bp_core_add_message( __('There was an error saving group details. Please try again.', 'buddypress'), 'error' ); 153 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create' ) ); 154 } 155 156 // Fetch the currently completed steps variable. 157 if ( isset( $_COOKIE['bp_completed_create_steps'] ) && !isset( $reset_steps ) ) 158 $bp->groups->completed_create_steps = json_decode( base64_decode( stripslashes( $_COOKIE['bp_completed_create_steps'] ) ) ); 159 160 // Set the ID of the new group, if it has already been created in a previous step. 161 if ( bp_get_new_group_id() ) { 162 $bp->groups->current_group = groups_get_group( $bp->groups->new_group_id ); 163 164 // Only allow the group creator to continue to edit the new group. 165 if ( ! bp_is_group_creator( $bp->groups->current_group, bp_loggedin_user_id() ) ) { 166 bp_core_add_message( __( 'Only the group creator may continue editing this group.', 'buddypress' ), 'error' ); 167 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create' ) ); 168 } 169 } 170 171 // If the save, upload or skip button is hit, lets calculate what we need to save. 172 if ( isset( $_POST['save'] ) ) { 173 174 // Check the nonce. 175 check_admin_referer( 'groups_create_save_' . bp_get_groups_current_create_step() ); 176 177 if ( 'group-details' == bp_get_groups_current_create_step() ) { 178 if ( empty( $_POST['group-name'] ) || empty( $_POST['group-desc'] ) || !strlen( trim( $_POST['group-name'] ) ) || !strlen( trim( $_POST['group-desc'] ) ) ) { 179 bp_core_add_message( __( 'Please fill in all of the required fields', 'buddypress' ), 'error' ); 180 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_get_groups_current_create_step() ) ); 181 } 182 183 $new_group_id = isset( $bp->groups->new_group_id ) ? $bp->groups->new_group_id : 0; 184 185 if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $new_group_id, 'name' => $_POST['group-name'], 'description' => $_POST['group-desc'], 'slug' => groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' => bp_core_current_time(), 'status' => 'public' ) ) ) { 186 bp_core_add_message( __( 'There was an error saving group details. Please try again.', 'buddypress' ), 'error' ); 187 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_get_groups_current_create_step() ) ); 188 } 189 } 190 191 if ( 'group-settings' == bp_get_groups_current_create_step() ) { 192 $group_status = 'public'; 193 $group_enable_forum = 1; 194 195 if ( !isset($_POST['group-show-forum']) ) { 196 $group_enable_forum = 0; 197 } 198 199 if ( 'private' == $_POST['group-status'] ) 200 $group_status = 'private'; 201 elseif ( 'hidden' == $_POST['group-status'] ) 202 $group_status = 'hidden'; 203 204 if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $bp->groups->new_group_id, 'status' => $group_status, 'enable_forum' => $group_enable_forum ) ) ) { 205 bp_core_add_message( __( 'There was an error saving group details. Please try again.', 'buddypress' ), 'error' ); 206 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_get_groups_current_create_step() ) ); 207 } 208 209 // Save group types. 210 if ( ! empty( $_POST['group-types'] ) ) { 211 bp_groups_set_group_type( $bp->groups->new_group_id, $_POST['group-types'] ); 212 } 213 214 /** 215 * Filters the allowed invite statuses. 216 * 217 * @since 1.5.0 218 * 219 * @param array $value Array of statuses allowed. 220 * Possible values are 'members, 221 * 'mods', and 'admins'. 222 */ 223 $allowed_invite_status = apply_filters( 'groups_allowed_invite_status', array( 'members', 'mods', 'admins' ) ); 224 $invite_status = !empty( $_POST['group-invite-status'] ) && in_array( $_POST['group-invite-status'], (array) $allowed_invite_status ) ? $_POST['group-invite-status'] : 'members'; 225 226 groups_update_groupmeta( $bp->groups->new_group_id, 'invite_status', $invite_status ); 227 } 228 229 if ( 'group-invites' === bp_get_groups_current_create_step() ) { 230 if ( ! empty( $_POST['friends'] ) ) { 231 foreach ( (array) $_POST['friends'] as $friend ) { 232 groups_invite_user( array( 233 'user_id' => (int) $friend, 234 'group_id' => $bp->groups->new_group_id, 235 ) ); 236 } 237 } 238 239 groups_send_invites( bp_loggedin_user_id(), $bp->groups->new_group_id ); 240 } 241 242 /** 243 * Fires before finalization of group creation and cookies are set. 244 * 245 * This hook is a variable hook dependent on the current step 246 * in the creation process. 247 * 248 * @since 1.1.0 249 */ 250 do_action( 'groups_create_group_step_save_' . bp_get_groups_current_create_step() ); 251 252 /** 253 * Fires after the group creation step is completed. 254 * 255 * Mostly for clearing cache on a generic action name. 256 * 257 * @since 1.1.0 258 */ 259 do_action( 'groups_create_group_step_complete' ); 260 261 /** 262 * Once we have successfully saved the details for this step of the creation process 263 * we need to add the current step to the array of completed steps, then update the cookies 264 * holding the information 265 */ 266 $completed_create_steps = isset( $bp->groups->completed_create_steps ) ? $bp->groups->completed_create_steps : array(); 267 if ( !in_array( bp_get_groups_current_create_step(), $completed_create_steps ) ) 268 $bp->groups->completed_create_steps[] = bp_get_groups_current_create_step(); 269 270 // Reset cookie info. 271 setcookie( 'bp_new_group_id', $bp->groups->new_group_id, time()+60*60*24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() ); 272 setcookie( 'bp_completed_create_steps', base64_encode( json_encode( $bp->groups->completed_create_steps ) ), time()+60*60*24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() ); 273 274 // If we have completed all steps and hit done on the final step we 275 // can redirect to the completed group. 276 $keys = array_keys( $bp->groups->group_creation_steps ); 277 if ( count( $bp->groups->completed_create_steps ) == count( $keys ) && bp_get_groups_current_create_step() == array_pop( $keys ) ) { 278 unset( $bp->groups->current_create_step ); 279 unset( $bp->groups->completed_create_steps ); 280 281 setcookie( 'bp_new_group_id', false, time() - 3600, COOKIEPATH, COOKIE_DOMAIN, is_ssl() ); 282 setcookie( 'bp_completed_create_steps', false, time() - 3600, COOKIEPATH, COOKIE_DOMAIN, is_ssl() ); 283 284 // Once we completed all steps, record the group creation in the activity stream. 285 groups_record_activity( array( 286 'type' => 'created_group', 287 'item_id' => $bp->groups->new_group_id 288 ) ); 289 290 /** 291 * Fires after the group has been successfully created. 292 * 293 * @since 1.1.0 294 * 295 * @param int $new_group_id ID of the newly created group. 296 */ 297 do_action( 'groups_group_create_complete', $bp->groups->new_group_id ); 298 299 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) ); 300 } else { 301 /** 302 * Since we don't know what the next step is going to be (any plugin can insert steps) 303 * we need to loop the step array and fetch the next step that way. 304 */ 305 foreach ( $keys as $key ) { 306 if ( $key == bp_get_groups_current_create_step() ) { 307 $next = 1; 308 continue; 309 } 310 311 if ( isset( $next ) ) { 312 $next_step = $key; 313 break; 314 } 315 } 316 317 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . $next_step ) ); 318 } 319 } 320 321 // Remove invitations. 322 if ( 'group-invites' === bp_get_groups_current_create_step() && ! empty( $_REQUEST['user_id'] ) && is_numeric( $_REQUEST['user_id'] ) ) { 323 if ( ! check_admin_referer( 'groups_invite_uninvite_user' ) ) { 324 return false; 325 } 326 327 $message = __( 'Invite successfully removed', 'buddypress' ); 328 $error = false; 329 330 if( ! groups_uninvite_user( (int) $_REQUEST['user_id'], $bp->groups->new_group_id ) ) { 331 $message = __( 'There was an error removing the invite', 'buddypress' ); 332 $error = 'error'; 333 } 334 335 bp_core_add_message( $message, $error ); 336 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/group-invites' ) ); 337 } 338 339 // Group avatar is handled separately. 340 if ( 'group-avatar' == bp_get_groups_current_create_step() && isset( $_POST['upload'] ) ) { 341 if ( ! isset( $bp->avatar_admin ) ) { 342 $bp->avatar_admin = new stdClass(); 343 } 344 345 if ( !empty( $_FILES ) && isset( $_POST['upload'] ) ) { 346 // Normally we would check a nonce here, but the group save nonce is used instead. 347 // Pass the file to the avatar upload handler. 348 if ( bp_core_avatar_handle_upload( $_FILES, 'groups_avatar_upload_dir' ) ) { 349 $bp->avatar_admin->step = 'crop-image'; 350 351 // Make sure we include the jQuery jCrop file for image cropping. 352 add_action( 'wp_print_scripts', 'bp_core_add_jquery_cropper' ); 353 } 354 } 355 356 // If the image cropping is done, crop the image and save a full/thumb version. 357 if ( isset( $_POST['avatar-crop-submit'] ) && isset( $_POST['upload'] ) ) { 358 359 // Normally we would check a nonce here, but the group save nonce is used instead. 360 $args = array( 361 'object' => 'group', 362 'avatar_dir' => 'group-avatars', 363 'item_id' => $bp->groups->current_group->id, 364 'original_file' => $_POST['image_src'], 365 'crop_x' => $_POST['x'], 366 'crop_y' => $_POST['y'], 367 'crop_w' => $_POST['w'], 368 'crop_h' => $_POST['h'] 369 ); 370 371 if ( ! bp_core_avatar_handle_crop( $args ) ) { 372 bp_core_add_message( __( 'There was an error saving the group profile photo, please try uploading again.', 'buddypress' ), 'error' ); 373 } else { 374 /** 375 * Fires after a group avatar is uploaded. 376 * 377 * @since 2.8.0 378 * 379 * @param int $group_id ID of the group. 380 * @param string $type Avatar type. 'crop' or 'full'. 381 * @param array $args Array of parameters passed to the avatar handler. 382 */ 383 do_action( 'groups_avatar_uploaded', bp_get_current_group_id(), 'crop', $args ); 384 385 bp_core_add_message( __( 'The group profile photo was uploaded successfully.', 'buddypress' ) ); 386 } 387 } 388 } 389 390 /** 391 * Filters the template to load for the group creation screen. 392 * 393 * @since 1.0.0 394 * 395 * @param string $value Path to the group creation template to load. 396 */ 397 bp_core_load_template( apply_filters( 'groups_template_create_group', 'groups/create' ) ); 398 } 399 add_action( 'bp_actions', 'groups_action_create_group' ); 400 401 /** 402 * Catch and process "Join Group" button clicks. 403 * 404 * @since 1.0.0 405 * 406 * @return bool 407 */ 408 function groups_action_join_group() { 409 410 if ( !bp_is_single_item() || !bp_is_groups_component() || !bp_is_current_action( 'join' ) ) 411 return false; 412 413 // Nonce check. 414 if ( !check_admin_referer( 'groups_join_group' ) ) 415 return false; 416 417 $bp = buddypress(); 418 419 // Skip if banned or already a member. 420 if ( !groups_is_user_member( bp_loggedin_user_id(), $bp->groups->current_group->id ) && !groups_is_user_banned( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) { 421 422 // User wants to join a group that is not public. 423 if ( bp_current_user_can( 'groups_join_group', array( 'group_id' => $bp->groups->current_group->id ) ) ) { 424 if ( !groups_check_user_has_invite( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) { 425 bp_core_add_message( __( 'There was an error joining the group.', 'buddypress' ), 'error' ); 426 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) ); 427 } 428 } 429 430 // User wants to join any group. 431 if ( !groups_join_group( $bp->groups->current_group->id ) ) 432 bp_core_add_message( __( 'There was an error joining the group.', 'buddypress' ), 'error' ); 433 else 434 bp_core_add_message( __( 'You joined the group!', 'buddypress' ) ); 435 436 bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) ); 437 } 438 439 /** 440 * Filters the template to load for the single group screen. 441 * 442 * @since 1.0.0 443 * 444 * @param string $value Path to the single group template to load. 445 */ 446 bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/single/home' ) ); 447 } 448 add_action( 'bp_actions', 'groups_action_join_group' ); 449 450 /** 451 * Catch and process "Leave Group" button clicks. 452 * 453 * When a group member clicks on the "Leave Group" button from a group's page, 454 * this function is run. 455 * 456 * Note: When leaving a group from the group directory, AJAX is used and 457 * another function handles this. See {@link bp_legacy_theme_ajax_joinleave_group()}. 458 * 459 * @since 1.2.4 460 * 461 * @return bool 462 */ 463 function groups_action_leave_group() { 464 if ( ! bp_is_single_item() || ! bp_is_groups_component() || ! bp_is_current_action( 'leave-group' ) ) { 465 return false; 466 } 467 468 // Nonce check. 469 if ( ! check_admin_referer( 'groups_leave_group' ) ) { 470 return false; 471 } 472 473 // User wants to leave any group. 474 if ( groups_is_user_member( bp_loggedin_user_id(), bp_get_current_group_id() ) ) { 475 $bp = buddypress(); 476 477 // Stop sole admins from abandoning their group. 478 $group_admins = groups_get_group_admins( bp_get_current_group_id() ); 479 480 if ( 1 == count( $group_admins ) && $group_admins[0]->user_id == bp_loggedin_user_id() ) { 481 bp_core_add_message( __( 'This group must have at least one admin', 'buddypress' ), 'error' ); 482 } elseif ( ! groups_leave_group( $bp->groups->current_group->id ) ) { 483 bp_core_add_message( __( 'There was an error leaving the group.', 'buddypress' ), 'error' ); 484 } else { 485 bp_core_add_message( __( 'You successfully left the group.', 'buddypress' ) ); 486 } 487 488 $group = groups_get_current_group(); 489 $redirect = bp_get_group_permalink( $group ); 490 491 if ( ! $group->is_visible ) { 492 $redirect = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ); 493 } 494 495 bp_core_redirect( $redirect ); 496 } 497 498 /** This filter is documented in bp-groups/bp-groups-actions.php */ 499 bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/single/home' ) ); 500 } 501 add_action( 'bp_actions', 'groups_action_leave_group' ); 502 503 /** 504 * Sort the group creation steps. 505 * 506 * @since 1.1.0 507 * 508 * @return false|null False on failure. 509 */ 510 function groups_action_sort_creation_steps() { 511 512 if ( !bp_is_groups_component() || !bp_is_current_action( 'create' ) ) 513 return false; 514 515 $bp = buddypress(); 516 517 if ( !is_array( $bp->groups->group_creation_steps ) ) 518 return false; 519 520 foreach ( (array) $bp->groups->group_creation_steps as $slug => $step ) { 521 while ( !empty( $temp[$step['position']] ) ) 522 $step['position']++; 523 524 $temp[$step['position']] = array( 'name' => $step['name'], 'slug' => $slug ); 525 } 526 527 // Sort the steps by their position key. 528 ksort($temp); 529 unset($bp->groups->group_creation_steps); 530 531 foreach( (array) $temp as $position => $step ) 532 $bp->groups->group_creation_steps[$step['slug']] = array( 'name' => $step['name'], 'position' => $position ); 533 534 /** 535 * Fires after group creation sets have been sorted. 536 * 537 * @since 2.3.0 538 */ 539 do_action( 'groups_action_sort_creation_steps' ); 540 } 541 542 /** 543 * Catch requests for a random group page (example.com/groups/?random-group) and redirect. 544 * 545 * @since 1.2.0 546 */ 547 function groups_action_redirect_to_random_group() { 548 549 if ( bp_is_groups_component() && isset( $_GET['random-group'] ) ) { 550 $group = BP_Groups_Group::get_random( 1, 1 ); 551 552 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . $group['groups'][0]->slug ) ); 553 } 554 } 555 add_action( 'bp_actions', 'groups_action_redirect_to_random_group' ); 556 557 /** 558 * Load the activity feed for the current group. 559 * 560 * @since 1.2.0 561 * 562 * @return false|null False on failure. 563 */ 564 function groups_action_group_feed() { 565 566 // Get current group. 567 $group = groups_get_current_group(); 568 569 if ( ! bp_is_active( 'activity' ) || ! bp_is_groups_component() || ! $group || ! bp_is_current_action( 'feed' ) ) 570 return false; 571 572 // If group isn't public or if logged-in user is not a member of the group, do 573 // not output the group activity feed. 574 if ( ! bp_group_is_visible( $group ) ) { 575 return false; 576 } 577 578 // Set up the feed. 579 buddypress()->activity->feed = new BP_Activity_Feed( array( 580 'id' => 'group', 581 582 /* translators: Group activity RSS title - "[Site Name] | [Group Name] | Activity" */ 583 'title' => sprintf( __( '%1$s | %2$s | Activity', 'buddypress' ), bp_get_site_name(), bp_get_current_group_name() ), 584 585 'link' => bp_get_group_permalink( $group ), 586 'description' => sprintf( __( "Activity feed for the group, %s.", 'buddypress' ), bp_get_current_group_name() ), 587 'activity_args' => array( 588 'object' => buddypress()->groups->id, 589 'primary_id' => bp_get_current_group_id(), 590 'display_comments' => 'threaded' 591 ) 592 ) ); 593 } 594 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.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 );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Apr 1 01:00:58 2018 | Cross-referenced by PHPXref 0.7.1 |