Changeset 5905 for trunk/src/includes/extend/buddypress/groups.php
- Timestamp:
- 08/10/2015 03:28:28 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/extend/buddypress/groups.php
r5868 r5905 83 83 84 84 // Possibly redirect 85 add_action( 'bbp_template_redirect', array( $this, 'redirect_canonical' ) );85 add_action( 'bbp_template_redirect', array( $this, 'redirect_canonical' ) ); 86 86 87 87 // Remove group forum cap map when view is done 88 add_action( 'bbp_after_group_forum_display', array( $this, 'remove_group_forum_meta_cap_map' ) ); 89 90 // bbPress needs to listen to BuddyPress group deletion. 91 add_action( 'groups_before_delete_group', array( $this, 'disconnect_forum_from_group' ) ); 88 add_action( 'bbp_after_group_forum_display', array( $this, 'remove_group_forum_meta_cap_map' ) ); 89 90 // Check if group-forum status should be changed 91 add_action( 'groups_group_after_save', array( $this, 'update_group_forum_visibility' ) ); 92 93 // bbPress needs to listen to BuddyPress group deletion 94 add_action( 'groups_before_delete_group', array( $this, 'disconnect_forum_from_group' ) ); 92 95 93 96 // Adds a bbPress metabox to the new BuddyPress Group Admin UI 94 add_action( 'bp_groups_admin_meta_boxes', array( $this, 'group_admin_ui_edit_screen' ) );97 add_action( 'bp_groups_admin_meta_boxes', array( $this, 'group_admin_ui_edit_screen' ) ); 95 98 96 99 // Saves the bbPress options if they come from the BuddyPress Group Admin UI 97 add_action( 'bp_group_admin_edit_after', array( $this, 'edit_screen_save' ) );100 add_action( 'bp_group_admin_edit_after', array( $this, 'edit_screen_save' ) ); 98 101 99 102 // Adds a hidden input value to the "Group Settings" page 100 add_action( 'bp_before_group_settings_admin', array( $this, 'group_settings_hidden_field' ) );103 add_action( 'bp_before_group_settings_admin', array( $this, 'group_settings_hidden_field' ) ); 101 104 } 102 105 … … 681 684 'group_id' => $group_id 682 685 ) ); 686 } 687 688 /** 689 * Set forums' status to match the privacy status of the associated group 690 * 691 * Fired whenever a group is saved 692 * 693 * @param BP_Groups_Group $group Group object. 694 */ 695 public static function update_group_forum_visibility( BP_Groups_Group $group ) { 696 697 // Get group forum IDs 698 $forum_ids = bbp_get_group_forum_ids( $group->id ); 699 700 // Bail if no forum IDs available 701 if ( empty( $forum_ids ) ) { 702 return; 703 } 704 705 // Loop through forum IDs 706 foreach ( $forum_ids as $forum_id ) { 707 708 // Get forum from ID 709 $forum = bbp_get_forum( $forum_id ); 710 711 // Check for change 712 if ( $group->status !== $forum->post_status ) { 713 switch ( $group->status ) { 714 715 // Changed to hidden 716 case 'hidden' : 717 bbp_hide_forum( $forum_id, $forum->post_status ); 718 break; 719 720 // Changed to private 721 case 'private' : 722 bbp_privatize_forum( $forum_id, $forum->post_status ); 723 break; 724 725 // Changed to public 726 case 'public' : 727 default : 728 bbp_publicize_forum( $forum_id, $forum->post_status ); 729 break; 730 } 731 } 732 } 683 733 } 684 734
Note: See TracChangeset
for help on using the changeset viewer.