Skip to:
Content

bbPress.org

Changeset 5027


Ignore:
Timestamp:
07/11/2013 12:36:05 AM (8 years ago)
Author:
johnjamesjacoby
Message:

Introduce group_settings_hidden_field() method to prevent the settings page from accidentally disabling the group forum. Props r-a-y. Fixes #2339.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/extend/buddypress/group.php

    r5017 r5027  
    9696        // Saves the bbPress options if they come from the BuddyPress Group Admin UI
    9797        add_action( 'bp_group_admin_edit_after',     array( $this, 'edit_screen_save'                ) );
     98
     99        // Adds a hidden input value to the "Group Settings" page
     100        add_action( 'bp_before_group_settings_admin', array( $this, 'group_settings_hidden_field'    ) );
    98101    }
    99102
     
    10691072
    10701073        return $retval;
     1074    }
     1075
     1076    /**
     1077     * Add a hidden input field on the group settings page if the group forum is
     1078     * enabled.
     1079     *
     1080     * Due to the way BuddyPress' group admin settings page saves its settings,
     1081     * we need to let BP know that bbPress added a forum.
     1082     *
     1083     * @since bbPress (r5026)
     1084     *
     1085     * @link http://bbpress.trac.wordpress.org/ticket/2339/
     1086     * @see groups_screen_group_admin_settings()
     1087     */
     1088    public function group_settings_hidden_field() {
     1089
     1090        // if a forum is not enabled, we don't need to add this field
     1091        if ( ! bp_group_is_forum_enabled() )
     1092            return; ?>
     1093
     1094        <input type="hidden" name="group-show-forum" id="group-show-forum" value="1" />
     1095   
     1096    <?php
    10711097    }
    10721098
Note: See TracChangeset for help on using the changeset viewer.