Skip to:
Content

bbPress.org


Ignore:
Timestamp:
07/08/2012 08:55:34 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Admin:

  • Introduce bail() method to forum/topic/reply components.
  • Bail out of other methods if post_type doesn't match.
  • Fixes issue where meta-box and styling were not always available on all appropriate screens.
  • Also reverts some perfomance improvements implimented in r4053.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-admin/bbp-forums.php

    r4053 r4070  
    3939     * @uses BBP_Forums_Admin::setup_help() Setup the help text
    4040     */
    41     function __construct() {
     41    public function __construct() {
    4242        $this->setup_globals();
    4343        $this->setup_actions();
     
    5656     * @uses bbp_get_reply_post_type() To get the reply post type
    5757     */
    58     function setup_actions() {
     58    private function setup_actions() {
    5959
    6060        // Add some general styling to the admin area
     
    8181
    8282    /**
     83     * Should we bail out of this method?
     84     *
     85     * @since bbPress (r4067)
     86     * @return boolean
     87     */
     88    private function bail() {
     89        if ( $this->post_type != get_current_screen()->post_type )
     90            return true;
     91
     92        return false;
     93    }
     94       
     95    /**
    8396     * Admin globals
    8497     *
     
    8699     * @access private
    87100     */
    88     function setup_globals() {
    89 
    90         // Setup the post type for this admin component
     101    private function setup_globals() {
    91102        $this->post_type = bbp_get_forum_post_type();
    92103    }
     
    101112     */
    102113    public function edit_help() {
     114
     115        if ( $this->bail() ) return;
    103116
    104117        // Overview
     
    164177    public function new_help() {
    165178
     179        if ( $this->bail() ) return;
     180
    166181        $customize_display = '<p>' . __( 'The title field and the big forum editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.', 'bbpress' ) . '</p>';
    167182
     
    234249     * @uses do_action() Calls 'bbp_forum_attributes_metabox'
    235250     */
    236     function attributes_metabox() {
     251    public function attributes_metabox() {
     252       
     253        if ( $this->bail() ) return;
     254
    237255        add_meta_box (
    238256            'bbp_forum_attributes',
     
    269287     * @return int Forum id
    270288     */
    271     function attributes_metabox_save( $forum_id ) {
     289    public function attributes_metabox_save( $forum_id ) {
     290
     291        if ( $this->bail() ) return $forum_id;
    272292
    273293        // Bail if doing an autosave
     
    312332     * @uses do_action() Calls 'bbp_admin_head'
    313333     */
    314     function admin_head() {
     334    public function admin_head() {
     335       
     336        if ( $this->bail() ) return;
     337
    315338        ?>
    316339
     
    388411     * @return array $columns bbPress forum columns
    389412     */
    390     function column_headers( $columns ) {
     413    public function column_headers( $columns ) {
     414       
     415        if ( $this->bail() ) return $columns;
     416
    391417        $columns = array (
    392418            'cb'                    => '<input type="checkbox" />',
     
    419445     *                    column and forum id
    420446     */
    421     function column_data( $column, $forum_id ) {
     447    public function column_data( $column, $forum_id ) {
     448       
     449        if ( $this->bail() ) return;
     450
    422451        switch ( $column ) {
    423452            case 'bbp_forum_topic_count' :
     
    465494     * @return array $actions Actions
    466495     */
    467     function row_actions( $actions, $forum ) {
     496    public function row_actions( $actions, $forum ) {
     497       
     498        if ( $this->bail() ) return $actions;
     499
    468500        unset( $actions['inline hide-if-no-js'] );
    469501
     
    489521     * @return array
    490522     */
    491     function updated_messages( $messages ) {
     523    public function updated_messages( $messages ) {
    492524        global $post_ID;
     525
     526        if ( $this->bail() ) return $messages;
    493527
    494528        // URL for the current forum
     
    556590 */
    557591function bbp_admin_forums() {
    558     global $typenow;
    559 
    560     if ( bbp_get_forum_post_type() != $typenow )
    561         return;
    562 
    563592    bbpress()->admin->forums = new BBP_Forums_Admin();
    564593}
Note: See TracChangeset for help on using the changeset viewer.