Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/03/2013 01:54:38 AM (13 years ago)
Author:
boonebgorges
Message:

Pass the group id to the edit_ and create_ methods of BP_Group_Extension

This change creates parity with the admin_screen() and admin_screen_save()
methods, which will make it easier for plugin authors to abstract shared logic.

See #4955

File:
1 edited

Legend:

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

    r6988 r6992  
    14281428        function widget_display() {}
    14291429
    1430         function edit_screen() {}
    1431 
    1432         function edit_screen_save() {}
    1433 
    1434         function create_screen() {}
    1435 
    1436         function create_screen_save() {}
     1430        function edit_screen( $group_id = null ) {}
     1431
     1432        function edit_screen_save( $group_id = null ) {}
     1433
     1434        function create_screen( $group_id = null ) {}
     1435
     1436        function create_screen_save( $group_id = null ) {}
    14371437
    14381438        // Private Methods
     
    15161516                        // Catch the edit screen and forward it to the plugin template
    15171517                        if ( bp_is_groups_component() && bp_is_current_action( 'admin' ) && bp_is_action_variable( $this->admin_slug, 0 ) ) {
    1518                                 // Check whether the user is saving changes
    1519                                 $this->edit_screen_save();
    1520 
    1521                                 add_action( 'groups_custom_edit_steps', array( &$this, 'edit_screen' ) );
     1518                                $this->edit_screen_save( bp_get_current_group_id() );
     1519
     1520                                add_action( 'groups_custom_edit_steps', array( &$this, 'call_edit_screen' ) );
    15221521
    15231522                                if ( '' != bp_locate_template( array( 'groups/single/home.php' ), false ) ) {
     
    15251524                                } else {
    15261525                                        add_action( 'bp_template_content_header', create_function( '', 'echo "<ul class=\"content-header-nav\">"; bp_group_admin_tabs(); echo "</ul>";' ) );
    1527                                         add_action( 'bp_template_content', array( &$this, 'edit_screen' ) );
     1526                                        add_action( 'bp_template_content', array( &$this, 'call_edit_screen' ) );
    15281527                                        bp_core_load_template( apply_filters( 'bp_core_template_plugin', '/groups/single/plugins' ) );
    15291528                                }
     
    15721571
    15731572        /**
     1573         * Call the edit_screen() method
     1574         *
     1575         * Broken into a standalone method so we can pass the current group id
     1576         * to edit_screen()
     1577         *
     1578         * @since 1.8
     1579         */
     1580        public function call_edit_screen() {
     1581                $this->edit_screen( bp_get_current_group_id() );
     1582        }
     1583
     1584        /**
    15741585         * Call the create_screen() method, if we're on the right page
    15751586         *
     
    15781589        public function maybe_create_screen() {
    15791590                if ( bp_is_group_creation_step( $this->slug ) ) {
    1580                         $this->create_screen();
     1591                        $this->create_screen( bp_get_new_group_id() );
    15811592                }
    15821593        }
     
    15891600        public function maybe_create_screen_save() {
    15901601                if ( bp_is_group_creation_step( $this->slug ) ) {
    1591                         $this->create_screen_save();
     1602                        $this->create_screen_save( bp_get_new_group_id() );
    15921603                }
    15931604        }
Note: See TracChangeset for help on using the changeset viewer.