本文整理汇总了PHP中bp_get_members_component_link函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_members_component_link函数的具体用法?PHP bp_get_members_component_link怎么用?PHP bp_get_members_component_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_members_component_link函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_members_admin_bar_user_admin_menu
/**
* Add the User Admin top-level menu to user pages.
*
* @since 1.5.0
*/
function bp_members_admin_bar_user_admin_menu()
{
global $wp_admin_bar;
// Only show if viewing a user
if (!bp_is_user()) {
return false;
}
// Don't show this menu to non site admins or if you're viewing your own profile
if (!current_user_can('edit_users') || bp_is_my_profile()) {
return false;
}
$bp = buddypress();
// Unique ID for the 'My Account' menu
$bp->user_admin_menu_id = 'user-admin';
// Add the top-level User Admin button
$wp_admin_bar->add_menu(array('id' => $bp->user_admin_menu_id, 'title' => __('Edit Member', 'buddypress'), 'href' => bp_displayed_user_domain()));
if (bp_is_active('xprofile')) {
// User Admin > Edit this user's profile
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => $bp->user_admin_menu_id . '-edit-profile', 'title' => __("Edit Profile", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'edit')));
// User Admin > Edit this user's avatar
if (buddypress()->avatar->show_avatars) {
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => $bp->user_admin_menu_id . '-change-avatar', 'title' => __("Edit Profile Photo", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'change-avatar')));
}
}
if (bp_is_active('settings')) {
// User Admin > Spam/unspam
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => $bp->user_admin_menu_id . '-user-capabilities', 'title' => __('User Capabilities', 'buddypress'), 'href' => bp_displayed_user_domain() . 'settings/capabilities/'));
// User Admin > Delete Account
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => $bp->user_admin_menu_id . '-delete-user', 'title' => __('Delete Account', 'buddypress'), 'href' => bp_displayed_user_domain() . 'settings/delete-account/'));
}
}
示例2: bp_members_admin_bar_user_admin_menu
/**
* Adds the User Admin top-level menu to user pages
*
* @package BuddyPress
* @since 1.5
*/
function bp_members_admin_bar_user_admin_menu()
{
global $bp, $wp_admin_bar;
// Only show if viewing a user
if (!bp_is_user()) {
return false;
}
// Don't show this menu to non site admins or if you're viewing your own profile
if (!current_user_can('edit_users') || bp_is_my_profile()) {
return false;
}
// User avatar
$avatar = bp_core_fetch_avatar(array('item_id' => $bp->displayed_user->id, 'email' => $bp->displayed_user->userdata->user_email, 'width' => 16, 'height' => 16));
// Unique ID for the 'My Account' menu
$bp->user_admin_menu_id = !empty($avatar) ? 'user-admin-with-avatar' : 'user-admin';
// Add the top-level User Admin button
$wp_admin_bar->add_menu(array('id' => $bp->user_admin_menu_id, 'title' => $avatar . bp_get_displayed_user_fullname(), 'href' => bp_displayed_user_domain()));
// User Admin > Edit this user's profile
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'edit-profile', 'title' => __("Edit Profile", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'edit')));
// User Admin > Edit this user's avatar
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'change-avatar', 'title' => __("Edit Avatar", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'change-avatar')));
// User Admin > Spam/unspam
if (!bp_core_is_user_spammer(bp_displayed_user_id())) {
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'spam-user', 'title' => __('Mark as Spammer', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/mark-spammer/', 'mark-unmark-spammer'), 'meta' => array('onclick' => 'confirm(" ' . __('Are you sure you want to mark this user as a spammer?', 'buddypress') . '");')));
} else {
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'unspam-user', 'title' => __('Not a Spammer', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/unmark-spammer/', 'mark-unmark-spammer'), 'meta' => array('onclick' => 'confirm(" ' . __('Are you sure you want to mark this user as not a spammer?', 'buddypress') . '");')));
}
// User Admin > Delete Account
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'delete-user', 'title' => __('Delete Account', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/delete-user/', 'delete-user'), 'meta' => array('onclick' => 'confirm(" ' . __("Are you sure you want to delete this user's account?", 'buddypress') . '");')));
}
示例3: restrict_blocked
public function restrict_blocked()
{
global $bp;
// if site admin, skip check
if ($bp->loggedin_user->is_site_admin == 1) {
return;
}
if (bp_is_user() && !bp_is_my_profile() && is_user_logged_in()) {
$displayed_id = bp_displayed_user_id();
$user_id = get_current_user_id();
if ($this->check_blocking($user_id, $displayed_id)) {
if (bp_is_current_component('blocked')) {
bp_register_template_stack('BP_Block_User::register_template_location');
add_filter('bp_get_template_part', array($this, 'replace_template'), 10, 3);
bp_core_load_template('members/single/plugins');
} else {
wp_redirect(bp_get_members_component_link('') . 'blocked/');
exit;
}
}
}
}
示例4: bp_members_component_link
/**
* Output a link to a members component subpage.
*
* @see bp_get_members_component_link() for description of parameters.
*
* @param string $component See {@bp_get_members_component_link()}.
* @param string $action See {@bp_get_members_component_link()}.
* @param string $query_args See {@bp_get_members_component_link()}.
* @param string|bool $nonce See {@bp_get_members_component_link()}.
*/
function bp_members_component_link($component, $action = '', $query_args = '', $nonce = false)
{
echo esc_url(bp_get_members_component_link($component, $action, $query_args, $nonce));
}