Skip to:
Content

bbPress.org

Ticket #3417: 3417.patch

File 3417.patch, 1.6 KB (added by johnjamesjacoby, 3 years ago)
  • src/includes/extend/buddypress/groups.php

     
    9090                add_action( 'bbp_edit_topic_pre_extras',      array( $this, 'validate_topic_forum_id' ) );
    9191                add_action( 'bbp_edit_reply_pre_extras',      array( $this, 'validate_reply_to_id'    ) );
    9292
    93                 // Check if group-forum status should be changed
    94                 add_action( 'groups_group_after_save',        array( $this, 'update_group_forum_visibility'  ) );
     93                // Check if group-forum attributes should be changed
     94                add_action( 'groups_group_after_save',        array( $this, 'update_group_forum' ) );
    9595
    9696                // bbPress needs to listen to BuddyPress group deletion
    9797                add_action( 'groups_before_delete_group',     array( $this, 'disconnect_forum_from_group'     ) );
     
    860860        }
    861861
    862862        /**
    863          * Set forums' status to match the privacy status of the associated group
     863         * Update forum attributes to match those of the associated group.
    864864         *
    865865         * Fired whenever a group is saved
    866866         *
    867867         * @param BP_Groups_Group $group Group object.
    868868         */
    869         public static function update_group_forum_visibility( BP_Groups_Group $group ) {
     869        public static function update_group_forum( BP_Groups_Group $group ) {
    870870
    871871                // Get group forum IDs
    872872                $forum_ids = bbp_get_group_forum_ids( $group->id );
     
    904904                                }
    905905                        }
    906906                }
     907
     908                // Maybe update the first group forum title, content, and slug
     909                if ( ! empty( $forum_ids[0] ) ) {
     910                        wp_update_post( array(
     911                                'ID'           => $forum_ids[0],
     912                                'post_title'   => $group->name,
     913                                'post_content' => $group->description,
     914                                'post_name'    => $group->slug
     915                        ) );
     916                }
    907917        }
    908918
    909919        /**