Skip to:
Content

BuddyPress.org

Changeset 5384


Ignore:
Timestamp:
11/27/2011 03:47:08 AM (13 years ago)
Author:
boonebgorges
Message:

Introduces admin_slug, admin_name, create_slug, and create_name properties for BP_Group_Extension, to provide for more flexibility in the way that admin and group creation tabs are named in plugins. Fixes #3206

File:
1 edited

Legend:

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

    r5329 r5384  
    11871187    var $name = false;
    11881188    var $slug = false;
     1189   
     1190    /* The name/slug of the Group Admin tab for this extension */
     1191    var $admin_name = '';
     1192    var $admin_slug = '';
     1193
     1194    /* The name/slug of the Group Creation tab for this extension */
     1195    var $create_name = '';
     1196    var $create_slug = '';
    11891197
    11901198    /* Will this extension be visible to non-members of a group? Options: public/private */
     
    12211229    function _register() {
    12221230        global $bp;
     1231       
     1232        // If admin/create names and slugs are not provided, they fall back on the main
     1233        // name and slug for the extension
     1234        if ( !$this->admin_name ) {
     1235            $this->admin_name = $this->name;
     1236        }
     1237       
     1238        if ( !$this->admin_slug ) {
     1239            $this->admin_slug = $this->slug;
     1240        }
     1241       
     1242        if ( !$this->create_name ) {
     1243            $this->create_name = $this->name;
     1244        }
     1245       
     1246        if ( !$this->create_slug ) {
     1247            $this->create_slug = $this->slug;
     1248        }
    12231249
    12241250        if ( !empty( $this->enable_create_step ) ) {
    12251251            // Insert the group creation step for the new group extension
    1226             $bp->groups->group_creation_steps[$this->slug] = array( 'name' => $this->name, 'slug' => $this->slug, 'position' => $this->create_step_position );
     1252            $bp->groups->group_creation_steps[$this->create_slug] = array( 'name' => $this->create_name, 'slug' => $this->create_slug, 'position' => $this->create_step_position );
    12271253
    12281254            // Attach the group creation step display content action
     
    12301256
    12311257            // Attach the group creation step save content action
    1232             add_action( 'groups_create_group_step_save_' . $this->slug, array( &$this, 'create_screen_save' ) );
     1258            add_action( 'groups_create_group_step_save_' . $this->create_slug, array( &$this, 'create_screen_save' ) );
    12331259        }
    12341260
     
    12541280        // Construct the admin edit tab for the new group extension
    12551281        if ( !empty( $this->enable_edit_item ) && !empty( $bp->is_item_admin ) ) {
    1256             add_action( 'groups_admin_tabs', create_function( '$current, $group_slug', '$selected = ""; if ( "' . esc_attr( $this->slug ) . '" == $current ) $selected = " class=\"current\""; echo "<li{$selected}><a href=\"' . bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/{$group_slug}/admin/' . esc_attr( $this->slug ) . '\">' . esc_attr( $this->name ) . '</a></li>";' ), 10, 2 );
     1282            add_action( 'groups_admin_tabs', create_function( '$current, $group_slug', '$selected = ""; if ( "' . esc_attr( $this->admin_slug ) . '" == $current ) $selected = " class=\"current\""; echo "<li{$selected}><a href=\"' . bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/{$group_slug}/admin/' . esc_attr( $this->admin_slug ) . '\">' . esc_attr( $this->admin_name ) . '</a></li>";' ), 10, 2 );
    12571283
    12581284            // Catch the edit screen and forward it to the plugin template
    1259             if ( bp_is_groups_component() && bp_is_current_action( 'admin' ) && bp_is_action_variable( $this->slug, 0 ) ) {
     1285            if ( bp_is_groups_component() && bp_is_current_action( 'admin' ) && bp_is_action_variable( $this->admin_slug, 0 ) ) {
    12601286                // Check whether the user is saving changes
    12611287                $this->edit_screen_save();
Note: See TracChangeset for help on using the changeset viewer.