Skip to:
Content

BuddyPress.org

Changeset 6988


Ignore:
Timestamp:
05/01/2013 08:12:37 PM (13 years ago)
Author:
boonebgorges
Message:

Only call BP_Group_Extension::create_screen* methods on proper creation step

By moving the bp_is_group_admin_screen() check into BP_Group_Extension, we
leave one fewer thing for plugins to miss in their implementations.

Load order issues mean that the calls to create_screen() and
create_screen_save() must be moved into standalone callbacks, and hooked
late in the load order so that we have access to information about the current
group creation step.

See #4955

File:
1 edited

Legend:

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

    r6987 r6988  
    14671467                        );
    14681468
    1469                         // Attach the group creation step display content action
    1470                         add_action( 'groups_custom_create_steps', array( &$this, 'create_screen' ) );
    1471 
    1472                         // Attach the group creation step save content action
    1473                         add_action( 'groups_create_group_step_save_' . $this->create_slug, array( &$this, 'create_screen_save' ) );
     1469                        // The maybe_ methods check to see whether the create_*
     1470                        // callbacks should be invoked (ie, are we on the
     1471                        // correct group creation step). Hooked in separate
     1472                        // methods because current creation step info not yet
     1473                        // available at this point
     1474                        add_action( 'groups_custom_create_steps', array( $this, 'maybe_create_screen' ) );
     1475                        add_action( 'groups_create_group_step_save_' . $this->create_slug, array( $this, 'maybe_create_screen_save' ) );
    14741476                }
    14751477
     
    15681570                );
    15691571        }
     1572
     1573        /**
     1574         * Call the create_screen() method, if we're on the right page
     1575         *
     1576         * @since 1.8
     1577         */
     1578        public function maybe_create_screen() {
     1579                if ( bp_is_group_creation_step( $this->slug ) ) {
     1580                        $this->create_screen();
     1581                }
     1582        }
     1583
     1584        /**
     1585         * Call the create_screen_save() method, if we're on the right page
     1586         *
     1587         * @since 1.8
     1588         */
     1589        public function maybe_create_screen_save() {
     1590                if ( bp_is_group_creation_step( $this->slug ) ) {
     1591                        $this->create_screen_save();
     1592                }
     1593        }
     1594
    15701595}
    15711596
Note: See TracChangeset for help on using the changeset viewer.