Skip to:
Content

BuddyPress.org

Changeset 6282


Ignore:
Timestamp:
08/31/2012 03:44:52 AM (12 years ago)
Author:
boonebgorges
Message:

Adds support for BP_Group_Extension plugins to Group Admin Dashboard UI

Introduces admin_screen() and admin_screen_save() methods to BP_Group_Extension
base class, paralleling create_screen() and edit_screen().

See #4414

Location:
trunk/bp-groups
Files:
2 edited

Legend:

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

    r6280 r6282  
    116116        add_meta_box( 'bp_group_add_members', _x( 'Add New Members', 'group admin edit screen', 'buddypress' ), 'bp_groups_admin_edit_metabox_add_new_members', get_current_screen()->id, 'normal', 'core' );
    117117        add_meta_box( 'bp_group_members',     _x( 'Manage Members', 'group admin edit screen', 'buddypress' ), 'bp_groups_admin_edit_metabox_members', get_current_screen()->id, 'normal', 'core' );
     118
     119        do_action( 'bp_groups_admin_meta_boxes' );
    118120
    119121        // Enqueue javascripts
     
    319321
    320322        // Call actions for plugins to do something before we redirect
    321         do_action_ref_array( 'bp_group_admin_edit_after', array( &$group, $error, $error_new, $success_new, $error_modified, $success_modified ) );
     323        do_action( 'bp_group_admin_edit_after', $group_id );
    322324
    323325        // Create the redirect URL
  • trunk/bp-groups/bp-groups-classes.php

    r6276 r6282  
    12951295    var $enable_nav_item = true;
    12961296    var $enable_edit_item = true;
     1297    var $enable_admin_item = true;
    12971298
    12981299    var $nav_item_name = false;
     
    13141315
    13151316    function create_screen_save() {}
     1317
     1318    function admin_screen( $group_id ) {}
     1319
     1320    function admin_screen_save( $group_id ) {}
    13161321
    13171322    // Private Methods
     
    13881393            }
    13891394        }
     1395
     1396        // Construct the admin metabox
     1397        if ( ! empty( $this->enable_admin_item ) ) {
     1398            // Hook the admin screen markup function to the content hook
     1399            add_action( 'bp_groups_admin_meta_box_content_' . $this->slug, array( $this, 'admin_screen' ) );
     1400
     1401            // Initialize the metabox
     1402            add_action( 'bp_groups_admin_meta_boxes', array( $this, '_meta_box_display_callback' ) );
     1403
     1404            // Catch the metabox save
     1405            add_action( 'bp_group_admin_edit_after', array( $this, 'admin_screen_save' ), 10 );
     1406        }
    13901407    }
    13911408
     
    13941411        bp_core_load_template( apply_filters( 'bp_core_template_plugin', $this->template_file ) );
    13951412    }
     1413
     1414    /**
     1415     * Create the Dashboard meta box for this extension
     1416     *
     1417     * @since BuddyPress (1.7)
     1418     */
     1419    function _meta_box_display_callback() {
     1420        $group_id = isset( $_GET['gid'] ) ? (int) $_GET['gid'] : 0;
     1421
     1422        add_meta_box(
     1423            $this->slug,
     1424            $this->name,
     1425            create_function( '', 'do_action( "bp_groups_admin_meta_box_content_' . $this->slug . '", ' . $group_id . ' );' ),
     1426            get_current_screen()->id,
     1427            'normal',
     1428            'core'
     1429        );
     1430    }
    13961431}
    13971432
     
    14031438    // Register the group extension on the bp_init action so we have access
    14041439    // to all plugins.
    1405     add_action( 'bp_init', create_function( '', '$extension = new ' . $group_extension_class . '; add_action( "bp_actions", array( &$extension, "_register" ), 8 );' ), 11 );
     1440    add_action( 'bp_init', create_function( '', '
     1441        $extension = new ' . $group_extension_class . ';
     1442        add_action( "bp_actions", array( &$extension, "_register" ), 8 );
     1443        add_action( "admin_init", array( &$extension, "_register" ) );
     1444    ' ), 11 );
    14061445}
    14071446
Note: See TracChangeset for help on using the changeset viewer.