Skip to:
Content

BuddyPress.org

Changeset 7140


Ignore:
Timestamp:
06/03/2013 02:09:18 PM (7 years ago)
Author:
boonebgorges
Message:

On group extension Edit screens, load template at bp_screens

On legacy themes (bp-default and derivatives), it's necessary to delay the
loading of the template, so that all group extensions have a chance to register
their navigation before exit() is called.

Fixes #4586

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-classes.php

    r7134 r7140  
    20452045            add_action( 'groups_custom_edit_steps', array( &$this, 'call_edit_screen' ) );
    20462046
     2047            // Determine the proper template and save for later
     2048            // loading
    20472049            if ( '' !== bp_locate_template( array( 'groups/single/home.php' ), false ) ) {
    2048                 bp_core_load_template( apply_filters( 'groups_template_group_home', 'groups/single/home' ) );
     2050                $this->edit_screen_template = '/groups/single/home';
    20492051            } else {
    20502052                add_action( 'bp_template_content_header', create_function( '', 'echo "<ul class=\"content-header-nav\">"; bp_group_admin_tabs(); echo "</ul>";' ) );
    20512053                add_action( 'bp_template_content', array( &$this, 'call_edit_screen' ) );
    2052                 bp_core_load_template( apply_filters( 'bp_core_template_plugin', '/groups/single/plugins' ) );
     2054                $this->edit_screen_template = '/groups/single/plugins';
    20532055            }
     2056
     2057            // We load the template at bp_screens, to give all
     2058            // extensions a chance to load
     2059            add_action( 'bp_screens', array( $this, 'call_edit_screen_template_loader' ) );
    20542060        }
    20552061    }
     
    20932099        $this->check_nonce( 'edit' );
    20942100        call_user_func( $this->screens['edit']['screen_save_callback'], $this->group_id );
     2101    }
     2102
     2103    /**
     2104     * Load the template that houses the Edit screen
     2105     *
     2106     * Separated out into a callback so that it can run after all other
     2107     * Group Extensions have had a chance to register their navigation, to
     2108     * avoid missing tabs.
     2109     *
     2110     * Hooked to 'bp_screens'.
     2111     *
     2112     * @see BP_Group_Extension::setup_edit_hooks()
     2113     * @access public So that do_action() has access. Do not call directly.
     2114     * @since BuddyPress (1.8)
     2115     */
     2116    public function call_edit_screen_template_loader() {
     2117        bp_core_load_template( $this->edit_screen_template );
    20952118    }
    20962119
Note: See TracChangeset for help on using the changeset viewer.