本文整理汇总了PHP中bp_admin_list_table_current_bulk_action函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_admin_list_table_current_bulk_action函数的具体用法?PHP bp_admin_list_table_current_bulk_action怎么用?PHP bp_admin_list_table_current_bulk_action使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_admin_list_table_current_bulk_action函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_bp_admin_list_table_current_bulk_action
public function test_bp_admin_list_table_current_bulk_action()
{
$_REQUEST['action'] = 'foo';
$_REQUEST['action2'] = '-1';
$this->assertEquals(bp_admin_list_table_current_bulk_action(), 'foo');
$_REQUEST['action'] = '-1';
$_REQUEST['action2'] = 'foo';
$this->assertEquals(bp_admin_list_table_current_bulk_action(), 'foo');
$_REQUEST['action'] = 'bar';
$_REQUEST['action2'] = 'foo';
$this->assertEquals(bp_admin_list_table_current_bulk_action(), 'foo');
}
示例2: bp_groups_admin
/**
* Select the appropriate Groups admin screen, and output it.
*
* @since 1.7.0
*/
function bp_groups_admin()
{
// Decide whether to load the index or edit screen
$doaction = bp_admin_list_table_current_bulk_action();
// Display the single group edit screen
if ('edit' == $doaction && !empty($_GET['gid'])) {
bp_groups_admin_edit();
// Display the group deletion confirmation screen
} elseif ('delete' == $doaction && !empty($_GET['gid'])) {
bp_groups_admin_delete();
// Otherwise, display the groups index screen
} else {
bp_groups_admin_index();
}
}
示例3: signups_admin
/**
* Signups admin page router.
*
* Depending on the context, display
* - the list of signups,
* - or the delete confirmation screen,
* - or the activate confirmation screen,
* - or the "resend" email confirmation screen.
*
* Also prepare the admin notices.
*
* @since 2.0.0
*/
public function signups_admin()
{
$doaction = bp_admin_list_table_current_bulk_action();
// Prepare notices for admin.
$notice = $this->get_signup_notice();
// Display notices.
if (!empty($notice)) {
if ('updated' === $notice['class']) {
?>
<div id="message" class="<?php
echo esc_attr($notice['class']);
?>
">
<?php
} else {
?>
<div class="<?php
echo esc_attr($notice['class']);
?>
">
<?php
}
?>
<p><?php
echo $notice['message'];
?>
</p>
<?php
if (!empty($_REQUEST['notactivated']) || !empty($_REQUEST['notdeleted']) || !empty($_REQUEST['notsent'])) {
?>
<ul><?php
$this->signups_display_errors();
?>
</ul>
<?php
}
?>
</div>
<?php
}
// Show the proper screen.
switch ($doaction) {
case 'activate':
case 'delete':
case 'resend':
$this->signups_admin_manage($doaction);
break;
default:
$this->signups_admin_index();
break;
}
}
示例4: bp_activity_admin_load
/**
* Set up the Activity admin page.
*
* Does the following:
* - Register contextual help and screen options for this admin page.
* - Enqueues scripts and styles.
* - Catches POST and GET requests related to Activity.
*
* @since BuddyPress (1.6.0)
*
* @global object $bp BuddyPress global settings.
* @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table.
*/
function bp_activity_admin_load()
{
global $bp_activity_list_table;
$bp = buddypress();
// Decide whether to load the dev version of the CSS and JavaScript
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : 'min.';
$doaction = bp_admin_list_table_current_bulk_action();
/**
* Fires at top of Activity admin page.
*
* @since BuddyPress (1.6.0)
*
* @param string $doaction Current $_GET action being performed in admin screen.
*/
do_action('bp_activity_admin_load', $doaction);
// Edit screen
if ('edit' == $doaction && !empty($_GET['aid'])) {
// columns screen option
add_screen_option('layout_columns', array('default' => 2, 'max' => 2));
get_current_screen()->add_help_tab(array('id' => 'bp-activity-edit-overview', 'title' => __('Overview', 'buddypress'), 'content' => '<p>' . __('You edit activities made on your site similar to the way you edit a comment. This is useful if you need to change which page the activity links to, or when you notice that the author has made a typographical error.', 'buddypress') . '</p>' . '<p>' . __('The two big editing areas for the activity title and content are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Primary Item/Secondary Item, Link, Type, Author ID) or to choose a 1- or 2-column layout for this screen.', 'buddypress') . '</p>' . '<p>' . __('You can also moderate the activity from this screen using the Status box, where you can also change the timestamp of the activity.', 'buddypress') . '</p>'));
get_current_screen()->add_help_tab(array('id' => 'bp-activity-edit-advanced', 'title' => __('Item, Link, Type', 'buddypress'), 'content' => '<p>' . __('<strong>Primary Item/Secondary Item</strong> - These identify the object that created the activity. For example, the fields could reference a comment left on a specific site. Some types of activity may only use one, or none, of these fields.', 'buddypress') . '</p>' . '<p>' . __('<strong>Link</strong> - Used by some types of activity (e.g blog posts and comments, and forum topics and replies) to store a link back to the original content.', 'buddypress') . '</p>' . '<p>' . __('<strong>Type</strong> - Each distinct kind of activity has its own type. For example, <code>created_group</code> is used when a group is created and <code>joined_group</code> is used when a user joins a group.', 'buddypress') . '</p>' . '<p>' . __('For information about when and how BuddyPress uses all of these settings, see the Managing Activity link in the panel to the side.', 'buddypress') . '</p>'));
// Help panel - sidebar links
get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:', 'buddypress') . '</strong></p>' . '<p>' . __('<a href="https://codex.buddypress.org/administrator-guide/activity-stream-management-panels/">Managing Activity</a>', 'buddypress') . '</p>' . '<p>' . __('<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress') . '</p>');
// Register metaboxes for the edit screen.
add_meta_box('submitdiv', _x('Status', 'activity admin edit screen', 'buddypress'), 'bp_activity_admin_edit_metabox_status', get_current_screen()->id, 'side', 'core');
add_meta_box('bp_activity_itemids', _x('Primary Item/Secondary Item', 'activity admin edit screen', 'buddypress'), 'bp_activity_admin_edit_metabox_itemids', get_current_screen()->id, 'normal', 'core');
add_meta_box('bp_activity_link', _x('Link', 'activity admin edit screen', 'buddypress'), 'bp_activity_admin_edit_metabox_link', get_current_screen()->id, 'normal', 'core');
add_meta_box('bp_activity_type', _x('Type', 'activity admin edit screen', 'buddypress'), 'bp_activity_admin_edit_metabox_type', get_current_screen()->id, 'normal', 'core');
add_meta_box('bp_activity_userid', _x('Author ID', 'activity admin edit screen', 'buddypress'), 'bp_activity_admin_edit_metabox_userid', get_current_screen()->id, 'normal', 'core');
// Enqueue JavaScript files
wp_enqueue_script('postbox');
wp_enqueue_script('dashboard');
wp_enqueue_script('comment');
// Index screen
} else {
// Create the Activity screen list table
$bp_activity_list_table = new BP_Activity_List_Table();
// per_page screen option
add_screen_option('per_page', array('label' => _x('Activity', 'Activity items per page (screen options)', 'buddypress')));
// Help panel - overview text
get_current_screen()->add_help_tab(array('id' => 'bp-activity-overview', 'title' => __('Overview', 'buddypress'), 'content' => '<p>' . __('You can manage activities made on your site similar to the way you manage comments and other content. This screen is customizable in the same ways as other management screens, and you can act on activities using the on-hover action links or the Bulk Actions.', 'buddypress') . '</p>' . '<p>' . __('There are many different types of activities. Some are generated automatically by BuddyPress and other plugins, and some are entered directly by a user in the form of status update. To help manage the different activity types, use the filter dropdown box to switch between them.', 'buddypress') . '</p>'));
// Help panel - moderation text
get_current_screen()->add_help_tab(array('id' => 'bp-activity-moderating', 'title' => __('Moderating Activity', 'buddypress'), 'content' => '<p>' . __('In the <strong>Activity</strong> column, above each activity it says “Submitted on,” followed by the date and time the activity item was generated on your site. Clicking on the date/time link will take you to that activity on your live site. Hovering over any activity gives you options to reply, edit, spam mark, or delete that activity.', 'buddypress') . '</p>' . '<p>' . __("In the <strong>In Response To</strong> column, if the activity was in reply to another activity, it shows that activity's author's picture and name, and a link to that activity on your live site. If there is a small bubble, the number in it shows how many other activities are related to this one; these are usually comments. Clicking the bubble will filter the activity screen to show only related activity items.", 'buddypress') . '</p>'));
// Help panel - sidebar links
get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:', 'buddypress') . '</strong></p>' . '<p>' . __('<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress') . '</p>');
}
// Enqueue CSS and JavaScript
wp_enqueue_script('bp_activity_admin_js', $bp->plugin_url . "bp-activity/admin/js/admin.{$min}js", array('jquery', 'wp-ajax-response'), bp_get_version(), true);
wp_localize_script('bp_activity_admin_js', 'bp_activity_admin_vars', array('page' => get_current_screen()->id));
wp_enqueue_style('bp_activity_admin_css', $bp->plugin_url . "bp-activity/admin/css/admin.{$min}css", array(), bp_get_version());
wp_style_add_data('bp_activity_admin_css', 'rtl', true);
if ($min) {
wp_style_add_data('bp_activity_admin_css', 'suffix', $min);
}
// Handle spam/un-spam/delete of activities
if (!empty($doaction) && !in_array($doaction, array('-1', 'edit', 'save'))) {
// Build redirection URL
$redirect_to = remove_query_arg(array('aid', 'deleted', 'error', 'spammed', 'unspammed'), wp_get_referer());
$redirect_to = add_query_arg('paged', $bp_activity_list_table->get_pagenum(), $redirect_to);
// Get activity IDs
$activity_ids = array_map('absint', (array) $_REQUEST['aid']);
/**
* Filters list of IDs being spammed/un-spammed/deleted.
*
* @since BuddyPress (1.6.0)
*
* @param array $activity_ids Activity IDs to spam/un-spam/delete.
*/
$activity_ids = apply_filters('bp_activity_admin_action_activity_ids', $activity_ids);
// Is this a bulk request?
if ('bulk_' == substr($doaction, 0, 5) && !empty($_REQUEST['aid'])) {
// Check this is a valid form submission
check_admin_referer('bulk-activities');
// Trim 'bulk_' off the action name to avoid duplicating a ton of code
$doaction = substr($doaction, 5);
// This is a request to delete, spam, or un-spam, a single item.
} elseif (!empty($_REQUEST['aid'])) {
// Check this is a valid form submission
check_admin_referer('spam-activity_' . $activity_ids[0]);
}
// Initialise counters for how many of each type of item we perform an action on
$deleted = $spammed = $unspammed = 0;
// Store any errors that occurs when updating the database items
$errors = array();
// "We'd like to shoot the monster, could you move, please?"
foreach ($activity_ids as $activity_id) {
// @todo: Check the permissions on each
//.........这里部分代码省略.........
示例5: signups_admin
/**
* Signups admin page router.
*
* Depending on the context, display
* - the list of signups
* - or the delete confirmation screen
* - or the activate confirmation screen
* - or the "resend" email confirmation screen
*
* Also prepare the admin notices.
*
* @since BuddyPress (2.0.0)
*/
public function signups_admin()
{
$doaction = bp_admin_list_table_current_bulk_action();
// Prepare notices for admin
$notice = array();
if (!empty($_REQUEST['updated'])) {
switch ($_REQUEST['updated']) {
case 'resent':
$notice = array('class' => 'updated', 'message' => '');
if (!empty($_REQUEST['resent'])) {
$notice['message'] .= sprintf(_nx('%s activation email successfully sent! ', '%s activation emails successfully sent! ', absint($_REQUEST['resent']), 'signup resent', 'buddypress'), number_format_i18n(absint($_REQUEST['resent'])));
}
if (!empty($_REQUEST['notsent'])) {
$notice['message'] .= sprintf(_nx('%s activation email was not sent.', '%s activation emails were not sent.', absint($_REQUEST['notsent']), 'signup notsent', 'buddypress'), number_format_i18n(absint($_REQUEST['notsent'])));
if (empty($_REQUEST['resent'])) {
$notice['class'] = 'error';
}
}
break;
case 'activated':
$notice = array('class' => 'updated', 'message' => '');
if (!empty($_REQUEST['activated'])) {
$notice['message'] .= sprintf(_nx('%s account successfully activated! ', '%s accounts successfully activated! ', absint($_REQUEST['activated']), 'signup resent', 'buddypress'), number_format_i18n(absint($_REQUEST['activated'])));
}
if (!empty($_REQUEST['notactivated'])) {
$notice['message'] .= sprintf(_nx('%s account was not activated.', '%s accounts were not activated.', absint($_REQUEST['notactivated']), 'signup notsent', 'buddypress'), number_format_i18n(absint($_REQUEST['notactivated'])));
if (empty($_REQUEST['activated'])) {
$notice['class'] = 'error';
}
}
break;
case 'deleted':
$notice = array('class' => 'updated', 'message' => '');
if (!empty($_REQUEST['deleted'])) {
$notice['message'] .= sprintf(_nx('%s sign-up successfully deleted!', '%s sign-ups successfully deleted!', absint($_REQUEST['deleted']), 'signup deleted', 'buddypress'), number_format_i18n(absint($_REQUEST['deleted'])));
}
if (!empty($_REQUEST['notdeleted'])) {
$notice['message'] .= sprintf(_nx('%s sign-up was not deleted.', '%s sign-ups were not deleted.', absint($_REQUEST['notdeleted']), 'signup notdeleted', 'buddypress'), number_format_i18n(absint($_REQUEST['notdeleted'])));
if (empty($_REQUEST['deleted'])) {
$notice['class'] = 'error';
}
}
break;
}
}
// Process error messages
if (!empty($_REQUEST['error'])) {
switch ($_REQUEST['error']) {
case 'do_resend':
$notice = array('class' => 'error', 'message' => esc_html__('There was a problem sending the activation emails, please try again.', 'buddypress'));
break;
case 'do_activate':
$notice = array('class' => 'error', 'message' => esc_html__('There was a problem activating accounts, please try again.', 'buddypress'));
break;
case 'do_delete':
$notice = array('class' => 'error', 'message' => esc_html__('There was a problem deleting sign-ups, please try again.', 'buddypress'));
break;
}
}
// Display notices
if (!empty($notice)) {
if ('updated' === $notice['class']) {
?>
<div id="message" class="<?php
echo esc_attr($notice['class']);
?>
">
<?php
} else {
?>
<div class="<?php
echo esc_attr($notice['class']);
?>
">
<?php
}
?>
<p><?php
echo $notice['message'];
?>
</p>
<?php
if (!empty($_REQUEST['notactivated']) || !empty($_REQUEST['notdeleted']) || !empty($_REQUEST['notsent'])) {
?>
<ul><?php
$this->signups_display_errors();
?>
//.........这里部分代码省略.........
示例6: bp_groups_admin_load
/**
* Set up the admin page before any output is sent. Register contextual help and screen options for this admin page.
*
* @global object $bp BuddyPress global settings
* @global BP_Groups_List_Table $bp_groups_list_table Groups screen list table
* @since BuddyPress (1.7)
*/
function bp_groups_admin_load()
{
global $bp_groups_list_table;
// Build redirection URL
$redirect_to = remove_query_arg(array('action', 'action2', 'gid', 'deleted', 'error', 'updated', 'success_new', 'error_new', 'success_modified', 'error_modified'), $_SERVER['REQUEST_URI']);
// Decide whether to load the dev version of the CSS and JavaScript
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : 'min.';
$doaction = bp_admin_list_table_current_bulk_action();
// Call an action for plugins to hook in early
do_action('bp_groups_admin_load', $doaction);
// Edit screen
if ('do_delete' == $doaction && !empty($_GET['gid'])) {
check_admin_referer('bp-groups-delete');
$group_ids = wp_parse_id_list($_GET['gid']);
$count = 0;
foreach ($group_ids as $group_id) {
if (groups_delete_group($group_id)) {
$count++;
}
}
$redirect_to = add_query_arg('deleted', $count, $redirect_to);
bp_core_redirect($redirect_to);
} else {
if ('edit' == $doaction && !empty($_GET['gid'])) {
// columns screen option
add_screen_option('layout_columns', array('default' => 2, 'max' => 2));
get_current_screen()->add_help_tab(array('id' => 'bp-group-edit-overview', 'title' => __('Overview', 'buddypress'), 'content' => '<p>' . __('This page is a convenient way to edit the details associated with one of your groups.', 'buddypress') . '</p>' . '<p>' . __('The Name and Description box is fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to hide or unhide, or to choose a 1- or 2-column layout for this screen.', 'buddypress') . '</p>'));
// Help panel - sidebar links
get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:', 'buddypress') . '</strong></p>' . '<p><a href="http://buddypress.org/support">' . __('Support Forums', 'buddypress') . '</a></p>');
// Register metaboxes for the edit screen.
add_meta_box('submitdiv', _x('Save', 'group admin edit screen', 'buddypress'), 'bp_groups_admin_edit_metabox_status', get_current_screen()->id, 'side', 'high');
add_meta_box('bp_group_settings', _x('Settings', 'group admin edit screen', 'buddypress'), 'bp_groups_admin_edit_metabox_settings', get_current_screen()->id, 'side', 'core');
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');
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');
do_action('bp_groups_admin_meta_boxes');
// Enqueue javascripts
wp_enqueue_script('postbox');
wp_enqueue_script('dashboard');
wp_enqueue_script('comment');
// Index screen
} else {
// Create the Groups screen list table
$bp_groups_list_table = new BP_Groups_List_Table();
// per_page screen option
add_screen_option('per_page', array('label' => _x('Groups', 'Groups per page (screen options)', 'buddypress')));
// Help panel - overview text
get_current_screen()->add_help_tab(array('id' => 'bp-groups-overview', 'title' => __('Overview', 'buddypress'), 'content' => '<p>' . __('You can manage groups much like you can manage comments and other content. This screen is customizable in the same ways as other management screens, and you can act on groups by using the on-hover action links or the Bulk Actions.', 'buddypress') . '</p>'));
get_current_screen()->add_help_tab(array('id' => 'bp-groups-overview-actions', 'title' => __('Group Actions', 'buddypress'), 'content' => '<p>' . __('Clicking "Visit" will take you to the group’s public page. Use this link to see what the group looks like on the front end of your site.', 'buddypress') . '</p>' . '<p>' . __('Clicking "Edit" will take you to a Dashboard panel where you can manage various details about the group, such as its name and description, its members, and other settings.', 'buddypress') . '</p>' . '<p>' . __('If you click "Delete" under a specific group, or select a number of groups and then choose Delete from the Bulk Actions menu, you will be led to a page where you’ll be asked to confirm the permanent deletion of the group(s).', 'buddypress') . '</p>'));
// Help panel - sidebar links
get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:', 'buddypress') . '</strong></p>' . '<p>' . __('<a href="http://buddypress.org/support/">Support Forums</a>', 'buddypress') . '</p>');
}
}
// Enqueue CSS and JavaScript
wp_enqueue_script('bp_groups_admin_js', BP_PLUGIN_URL . "bp-groups/admin/js/admin.{$min}js", array('jquery', 'wp-ajax-response', 'jquery-ui-autocomplete'), bp_get_version(), true);
wp_enqueue_style('bp_groups_admin_css', BP_PLUGIN_URL . "bp-groups/admin/css/admin.{$min}css", array(), bp_get_version());
wp_localize_script('bp_groups_admin_js', 'BP_Group_Admin', array('add_member_placeholder' => __('Start typing a username to add a new member.', 'buddypress'), 'warn_on_leave' => __('If you leave this page, you will lose any unsaved changes you have made to the group.', 'buddypress')));
if ($doaction && 'save' == $doaction) {
// Get group ID
$group_id = isset($_REQUEST['gid']) ? (int) $_REQUEST['gid'] : '';
$redirect_to = add_query_arg(array('gid' => (int) $group_id, 'action' => 'edit'), $redirect_to);
// Check this is a valid form submission
check_admin_referer('edit-group_' . $group_id);
// Get the group from the database
$group = groups_get_group('group_id=' . $group_id);
// If the group doesn't exist, just redirect back to the index
if (empty($group->slug)) {
wp_redirect($redirect_to);
exit;
}
// Check the form for the updated properties
// Store errors
$error = 0;
$success_new = $error_new = $success_modified = $error_modified = array();
// Group name and description are handled with
// groups_edit_base_group_details()
if (!groups_edit_base_group_details($group_id, $_POST['bp-groups-name'], $_POST['bp-groups-description'], 0)) {
$error = $group_id;
}
// Enable discussion forum
$enable_forum = isset($_POST['group-show-forum']) ? 1 : 0;
// Privacy setting
$allowed_status = apply_filters('groups_allowed_status', array('public', 'private', 'hidden'));
$status = in_array($_POST['group-status'], (array) $allowed_status) ? $_POST['group-status'] : 'public';
// Invite status
$allowed_invite_status = apply_filters('groups_allowed_invite_status', array('members', 'mods', 'admins'));
$invite_status = in_array($_POST['group-invite-status'], (array) $allowed_invite_status) ? $_POST['group-invite-status'] : 'members';
if (!groups_edit_group_settings($group_id, $enable_forum, $status, $invite_status)) {
$error = $group_id;
}
// Process new members
$user_names = array();
if (!empty($_POST['bp-groups-new-members'])) {
$user_names = array_merge($user_names, explode(',', $_POST['bp-groups-new-members']));
//.........这里部分代码省略.........