群组的管理 UI 界面

群组的管理 UI 界面

Codex Home → BuddyPress Plugin Development → Admin UI for Groups
Admin UI for Groups

In BuddyPress 1.7, the Groups Component comes with a great Admin UI that allows Community Administrator to easily manage the created groups (members, settings…) directly from the WordPress backend.
Edit Group Admin Screen
As plugin authors, I think we should enjoy this new area and let the Community Administrator manage the settings of the group extension we might use in our custom component. To do so, I think the best way is to enrich the class we use to extend the BP Group Extension API.
Let』s consider this class as our plugin』s group component, just to refresh our memory about the BP Group Extension API  class and its functions:
class Bp_Plugin_Group extends BP_Group_Extension {
function __construct() {}
function create_screen() {}
function create_screen_save() {}
function edit_screen() {}
function edit_screen_save() {}
function admin_screen() {}
function admin_screen_save() {}
function display() {}
function widget_display() {}
function enable_nav_item() {}
}
bp_register_group_extension( 'Bp_Plugin_Group' );

Adding a meta box for our component in the 「Edit Group」 Admin screen.
When creating your component utilizing the BP Group Extension API you can include the functions below to add a meta box to the Group Admin Page. You can create anything from displaying group content or allowing an admin to update the group meta. The  admin_screen_save() function has an example of getting form parameters out of the $_POST global and saving it into the group meta.
function admin_screen( $group_id ) {
?>

The HTML for my admin panel.

name ) ?>

You could display a small snippet of information from your group extension here. It will show on the group
home screen.

<?php
}
}

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注