当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_core_can_edit_settings函数代码示例

本文整理汇总了PHP中bp_core_can_edit_settings函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_can_edit_settings函数的具体用法?PHP bp_core_can_edit_settings怎么用?PHP bp_core_can_edit_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_core_can_edit_settings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setup_nav

 /**
  * Set up component navigation.
  *
  * @since 1.9.0
  *
  * @see BP_Component::setup_nav() for a description of arguments.
  *
  * @param array $main_nav Optional. See BP_Component::setup_nav() for
  *                        description.
  * @param array $sub_nav  Optional. See BP_Component::setup_nav() for
  *                        description.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $access = bp_core_can_edit_settings();
     $slug = bp_get_notifications_slug();
     $notifications_link = trailingslashit($user_domain . $slug);
     // Only grab count if we're on a user page and current user has access
     if (bp_is_user() && bp_user_has_access()) {
         $count = bp_notifications_get_unread_notification_count(bp_displayed_user_id());
         $class = 0 === $count ? 'no-count' : 'count';
         $nav_name = sprintf(_x('Notifications <span class="%s">%s</span>', 'Profile screen nav', 'buddypress'), esc_attr($class), bp_core_number_format($count));
     } else {
         $nav_name = _x('Notifications', 'Profile screen nav', 'buddypress');
     }
     // Add 'Notifications' to the main navigation
     $main_nav = array('name' => $nav_name, 'slug' => $slug, 'position' => 30, 'show_for_displayed_user' => $access, 'screen_function' => 'bp_notifications_screen_unread', 'default_subnav_slug' => 'unread', 'item_css_id' => $this->id);
     // Add the subnav items to the notifications nav item
     $sub_nav[] = array('name' => _x('Unread', 'Notification screen nav', 'buddypress'), 'slug' => 'unread', 'parent_url' => $notifications_link, 'parent_slug' => $slug, 'screen_function' => 'bp_notifications_screen_unread', 'position' => 10, 'item_css_id' => 'notifications-my-notifications', 'user_has_access' => $access);
     $sub_nav[] = array('name' => _x('Read', 'Notification screen nav', 'buddypress'), 'slug' => 'read', 'parent_url' => $notifications_link, 'parent_slug' => $slug, 'screen_function' => 'bp_notifications_screen_read', 'position' => 20, 'user_has_access' => $access);
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:40,代码来源:bp-notifications-loader.php

示例2: setup_nav

 /**
  * Setup BuddyBar navigation
  */
 function setup_nav()
 {
     // Define local variable
     $sub_nav = array();
     // Add the settings navigation item
     $main_nav = array('name' => __('Settings', 'buddypress'), 'slug' => $this->slug, 'position' => 100, 'show_for_displayed_user' => bp_core_can_edit_settings(), 'screen_function' => 'bp_settings_screen_general', 'default_subnav_slug' => 'general');
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $settings_link = trailingslashit($user_domain . $this->slug);
     // Add General Settings nav item
     $sub_nav[] = array('name' => __('General', 'buddypress'), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_general', 'position' => 10, 'user_has_access' => bp_core_can_edit_settings());
     // Add Notifications nav item
     $sub_nav[] = array('name' => __('Notifications', 'buddypress'), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_notification', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
     // Add Spam Account nav item
     if (bp_current_user_can('bp_moderate')) {
         $sub_nav[] = array('name' => __('Capabilities', 'buddypress'), 'slug' => 'capabilities', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_capabilities', 'position' => 80, 'user_has_access' => !bp_is_my_profile());
     }
     // Add Delete Account nav item
     if (!bp_disable_account_deletion() || bp_current_user_can('delete_users')) {
         $sub_nav[] = array('name' => __('Delete Account', 'buddypress'), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_delete_account', 'position' => 90, 'user_has_access' => bp_is_my_profile() || !is_super_admin(bp_displayed_user_id()));
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:32,代码来源:bp-settings-loader.php

示例3: setup_nav

 /**
  * Set up navigation.
  *
  * @param array $main_nav Array of main nav items.
  * @param array $sub_nav  Array of sub nav items.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $access = bp_core_can_edit_settings();
     $slug = bp_get_settings_slug();
     $settings_link = trailingslashit($user_domain . $slug);
     // Add the settings navigation item
     $main_nav = array('name' => __('Settings', 'buddypress'), 'slug' => $slug, 'position' => 100, 'show_for_displayed_user' => $access, 'screen_function' => 'bp_settings_screen_general', 'default_subnav_slug' => 'general');
     // Add General Settings nav item
     $sub_nav[] = array('name' => __('General', 'buddypress'), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_general', 'position' => 10, 'user_has_access' => $access);
     // Add Email nav item. Formerly called 'Notifications', we
     // retain the old slug and function names for backward compat
     $sub_nav[] = array('name' => __('Email', 'buddypress'), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_notification', 'position' => 20, 'user_has_access' => $access);
     // Add Spam Account nav item
     if (bp_current_user_can('bp_moderate')) {
         $sub_nav[] = array('name' => __('Capabilities', 'buddypress'), 'slug' => 'capabilities', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_capabilities', 'position' => 80, 'user_has_access' => !bp_is_my_profile());
     }
     // Add Delete Account nav item
     if (!bp_disable_account_deletion() && bp_is_my_profile() || bp_current_user_can('delete_users')) {
         $sub_nav[] = array('name' => __('Delete Account', 'buddypress'), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_delete_account', 'position' => 90, 'user_has_access' => !is_super_admin(bp_displayed_user_id()));
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:36,代码来源:bp-settings-loader.php

示例4: setup_nav

 /**
  * Set up the navigation.
  *
  * @since 1.0.0
  * @access public
  *
  * @param array $main_nav Optional. See BP_Component::setup_nav().
  * @param array $sub_nav Optional. See BP_Component::setup_nav().
  */
 function setup_nav($main_nav = array(), $sub_nav = array())
 {
     $count = Mute::get_count(bp_displayed_user_id());
     $class = $count === 0 ? 'no-count' : 'count';
     $main_nav = array('name' => sprintf(__('Mute <span class="%s">%s</span>', 'buddypress-mute'), esc_attr($class), number_format_i18n($count)), 'position' => 80, 'default_subnav_slug' => 'all', 'slug' => $this->slug, 'item_css_id' => $this->id, 'show_for_displayed_user' => bp_core_can_edit_settings(), 'screen_function' => 'bp_mute_all_screen');
     $sub_nav[] = array('name' => __('All', 'buddypress-mute'), 'slug' => 'all', 'position' => 10, 'parent_slug' => $this->slug, 'parent_url' => trailingslashit(bp_displayed_user_domain() . $this->slug), 'user_has_access' => bp_core_can_edit_settings(), 'screen_function' => 'bp_mute_all_screen');
     if (bp_is_active('friends')) {
         $sub_nav[] = array('name' => __('Friends', 'buddypress-mute'), 'slug' => 'friends', 'position' => 20, 'parent_slug' => $this->slug, 'parent_url' => trailingslashit(bp_displayed_user_domain() . $this->slug), 'user_has_access' => bp_core_can_edit_settings(), 'screen_function' => 'bp_mute_friends_screen');
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:sbrajesh,项目名称:buddypress-mute,代码行数:20,代码来源:class-mute-component.php

示例5: bp_xprofile_settings_add_feedback_message

/**
 * Adds feedback messages when successfully saving profile field settings.
 *
 * @since 2.0.0
 *
 * @uses bp_core_add_message()
 * @uses bp_is_my_profile()
 */
function bp_xprofile_settings_add_feedback_message()
{
    // Default message type is success.
    $type = 'success';
    $message = __('Your profile settings have been saved.', 'buddypress');
    // Community moderator editing another user's settings.
    if (!bp_is_my_profile() && bp_core_can_edit_settings()) {
        $message = __("This member's profile settings have been saved.", 'buddypress');
    }
    // Add the message.
    bp_core_add_message($message, $type);
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:20,代码来源:bp-xprofile-settings.php

示例6: profile_tab

 /**
  * Create a tab on member profile pages
  */
 public function profile_tab()
 {
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $parent_url = trailingslashit($user_domain . $this->slug);
     $nav_text = __('Papers', 'social-paper');
     // create primary nav
     bp_core_new_nav_item(array('name' => $nav_text, 'slug' => $this->slug, 'item_css_id' => 'user-papers', 'show_for_displayed_user' => true, 'site_admin_only' => false, 'position' => $this->position, 'screen_function' => 'cacsp_profile_screen', 'default_subnav_slug' => $this->published_slug));
     // create subnav items
     bp_core_new_subnav_item(array('name' => __('Published', 'social-paper'), 'slug' => $this->published_slug, 'parent_url' => $parent_url, 'parent_slug' => $this->slug, 'screen_function' => 'cacsp_profile_screen_published', 'position' => 10));
     bp_core_new_subnav_item(array('name' => __('Drafts', 'social-paper'), 'slug' => $this->drafts_slug, 'parent_url' => $parent_url, 'parent_slug' => $this->slug, 'screen_function' => 'cacsp_profile_screen_draft', 'position' => 10, 'user_has_access' => bp_core_can_edit_settings()));
 }
开发者ID:sheesh,项目名称:social-paper,代码行数:21,代码来源:hooks-buddypress-profile.php

示例7: setup_nav

 /**
  * Setup BuddyBar navigation
  *
  * @global BuddyPress $bp The one true BuddyPress instance
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     global $bp;
     $sub_nav = array();
     // Add 'Friends' to the main navigation
     $main_nav = array('name' => sprintf(__('Friends <span>%d</span>', 'buddypress'), friends_get_total_friend_count()), 'slug' => $this->slug, 'position' => 60, 'screen_function' => 'friends_screen_my_friends', 'default_subnav_slug' => 'my-friends', 'item_css_id' => $bp->friends->id);
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $friends_link = trailingslashit($user_domain . bp_get_friends_slug());
     // Add the subnav items to the friends nav item
     $sub_nav[] = array('name' => __('Friendships', 'buddypress'), 'slug' => 'my-friends', 'parent_url' => $friends_link, 'parent_slug' => bp_get_friends_slug(), 'screen_function' => 'friends_screen_my_friends', 'position' => 10, 'item_css_id' => 'friends-my-friends');
     $sub_nav[] = array('name' => __('Requests', 'buddypress'), 'slug' => 'requests', 'parent_url' => $friends_link, 'parent_slug' => bp_get_friends_slug(), 'screen_function' => 'friends_screen_requests', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:25,代码来源:bp-friends-loader.php

示例8: wpmudev_chat_buddypress_settings_setup_nav

function wpmudev_chat_buddypress_settings_setup_nav()
{
    global $wpmudev_chat;
    $slug_parent = 'settings';
    $slug_page = 'chat';
    // Set thsi so when we get to wp_footer it knows we need to load the JS/CSS for the Friends display.
    $wpmudev_chat->_chat_plugin_settings['blocked_urls']['front'] = false;
    // Determine user to use
    if (bp_displayed_user_domain()) {
        $user_domain = bp_displayed_user_domain();
    } elseif (bp_loggedin_user_domain()) {
        $user_domain = bp_loggedin_user_domain();
    } else {
        return;
    }
    //echo "user_domain=[". $user_domain ."]<br />";
    $settings_link = trailingslashit($user_domain . $slug_parent);
    //echo "settings_link=[". $settings_link ."]<br />";
    $sub_nav = array('name' => __('Chat', $wpmudev_chat->translation_domain), 'slug' => $slug_page, 'parent_url' => $settings_link, 'parent_slug' => $slug_parent, 'screen_function' => 'wpmudev_chat_settings_screen_chat_proc', 'position' => 30, 'user_has_access' => bp_core_can_edit_settings());
    bp_core_new_subnav_item($sub_nav);
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:21,代码来源:wpmudev_chat_buddypress.php

示例9: setup_nav

 /**
  * Setup BuddyBar navigation
  *
  * @global obj $bp
  */
 function setup_nav()
 {
     global $bp;
     // Add the settings navigation item
     $main_nav = array('name' => __('Settings', 'buddypress'), 'slug' => $this->slug, 'position' => 100, 'show_for_displayed_user' => bp_core_can_edit_settings(), 'screen_function' => 'bp_core_screen_general_settings', 'default_subnav_slug' => 'general');
     // Determine user to use
     if (isset($bp->displayed_user->domain)) {
         $user_domain = $bp->displayed_user->domain;
     } elseif (isset($bp->loggedin_user->domain)) {
         $user_domain = $bp->loggedin_user->domain;
     } else {
         return;
     }
     $settings_link = trailingslashit($user_domain . $this->slug);
     // Add General Settings nav item
     $sub_nav[] = array('name' => __('General', 'buddypress'), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_core_screen_general_settings', 'position' => 10, 'user_has_access' => bp_core_can_edit_settings());
     // Add Notifications nav item
     $sub_nav[] = array('name' => __('Notifications', 'buddypress'), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_core_screen_notification_settings', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
     // Add Delete Account nav item
     if (!bp_current_user_can('bp_moderate') && empty($bp->site_options['bp-disable-account-deletion'])) {
         $sub_nav[] = array('name' => __('Delete Account', 'buddypress'), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_core_screen_delete_account', 'position' => 90, 'user_has_access' => bp_is_my_profile());
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:newington,项目名称:buddypress,代码行数:29,代码来源:bp-settings-loader.php

示例10: setup_nav

 /**
  * Setup BuddyBar navigation
  *
  * @global BuddyPress $bp The one true BuddyPress instance
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     $sub_nav = array();
     $name = sprintf(__('Messages <span>%s</span>', 'buddypress'), bp_get_total_unread_messages_count());
     // Add 'Messages' to the main navigation
     $main_nav = array('name' => $name, 'slug' => $this->slug, 'position' => 50, 'show_for_displayed_user' => false, 'screen_function' => 'messages_screen_inbox', 'default_subnav_slug' => 'inbox', 'item_css_id' => $this->id);
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     // Link to user messages
     $messages_link = trailingslashit($user_domain . $this->slug);
     // Add the subnav items to the profile
     $sub_nav[] = array('name' => __('Inbox', 'buddypress'), 'slug' => 'inbox', 'parent_url' => $messages_link, 'parent_slug' => $this->slug, 'screen_function' => 'messages_screen_inbox', 'position' => 10, 'user_has_access' => bp_core_can_edit_settings());
     $sub_nav[] = array('name' => __('Sent', 'buddypress'), 'slug' => 'sentbox', 'parent_url' => $messages_link, 'parent_slug' => $this->slug, 'screen_function' => 'messages_screen_sentbox', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
     $sub_nav[] = array('name' => __('Compose', 'buddypress'), 'slug' => 'compose', 'parent_url' => $messages_link, 'parent_slug' => $this->slug, 'screen_function' => 'messages_screen_compose', 'position' => 30, 'user_has_access' => bp_core_can_edit_settings());
     if (bp_current_user_can('bp_moderate')) {
         $sub_nav[] = array('name' => __('Notices', 'buddypress'), 'slug' => 'notices', 'parent_url' => $messages_link, 'parent_slug' => $this->slug, 'screen_function' => 'messages_screen_notices', 'position' => 90, 'user_has_access' => bp_current_user_can('bp_moderate'));
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:30,代码来源:bp-messages-loader.php

示例11: setup_nav

 /**
  * Setup BuddyBar navigation
  *
  * @global BuddyPress $bp The one true BuddyPress instance
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Define local variables
     $sub_nav = array();
     // Add 'Groups' to the main navigation
     $main_nav = array('name' => sprintf(__('Groups <span>%d</span>', 'buddypress'), bp_get_total_group_count_for_user()), 'slug' => $this->slug, 'position' => 70, 'screen_function' => 'groups_screen_my_groups', 'default_subnav_slug' => 'my-groups', 'item_css_id' => $this->id);
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         $user_domain = false;
     }
     if (!empty($user_domain)) {
         $groups_link = trailingslashit($user_domain . $this->slug);
         // Add the My Groups nav item
         $sub_nav[] = array('name' => __('Memberships', 'buddypress'), 'slug' => 'my-groups', 'parent_url' => $groups_link, 'parent_slug' => $this->slug, 'screen_function' => 'groups_screen_my_groups', 'position' => 10, 'item_css_id' => 'groups-my-groups');
         // Add the Group Invites nav item
         $sub_nav[] = array('name' => __('Invitations', 'buddypress'), 'slug' => 'invites', 'parent_url' => $groups_link, 'parent_slug' => $this->slug, 'screen_function' => 'groups_screen_group_invites', 'user_has_access' => bp_core_can_edit_settings(), 'position' => 30);
         parent::setup_nav($main_nav, $sub_nav);
     }
     if (bp_is_groups_component() && bp_is_single_item()) {
         // Reset sub nav
         $sub_nav = array();
         // Add 'Groups' to the main navigation
         $main_nav = array('name' => __('Memberships', 'buddypress'), 'slug' => $this->current_group->slug, 'position' => -1, 'screen_function' => 'groups_screen_group_home', 'default_subnav_slug' => $this->default_extension, 'item_css_id' => $this->id);
         $group_link = bp_get_group_permalink($this->current_group);
         // Add the "Home" subnav item, as this will always be present
         $sub_nav[] = array('name' => _x('Home', 'Group home navigation title', 'buddypress'), 'slug' => 'home', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_home', 'position' => 10, 'item_css_id' => 'home');
         // If this is a private group, and the user is not a member, show a "Request Membership" nav item.
         if (is_user_logged_in() && !bp_current_user_can('bp_moderate') && !$this->current_group->is_user_member && !groups_check_for_membership_request(bp_loggedin_user_id(), $this->current_group->id) && $this->current_group->status == 'private') {
             $sub_nav[] = array('name' => __('Request Membership', 'buddypress'), 'slug' => 'request-membership', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_request_membership', 'position' => 30);
         }
         // Forums are enabled and turned on
         if ($this->current_group->enable_forum && bp_is_active('forums')) {
             $sub_nav[] = array('name' => __('Forum', 'buddypress'), 'slug' => 'forum', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_forum', 'position' => 40, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'forums');
         }
         $sub_nav[] = array('name' => sprintf(__('Members <span>%s</span>', 'buddypress'), number_format($this->current_group->total_member_count)), 'slug' => 'members', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_members', 'position' => 60, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'members');
         if (bp_is_active('friends') && bp_groups_user_can_send_invites()) {
             $sub_nav[] = array('name' => __('Send Invites', 'buddypress'), 'slug' => 'send-invites', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_invite', 'item_css_id' => 'invite', 'position' => 70, 'user_has_access' => $this->current_group->user_has_access);
         }
         // If the user is a group admin, then show the group admin nav item
         if (bp_is_item_admin()) {
             $sub_nav[] = array('name' => __('Admin', 'buddypress'), 'slug' => 'admin', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_admin', 'position' => 1000, 'user_has_access' => true, 'item_css_id' => 'admin');
         }
         parent::setup_nav($main_nav, $sub_nav);
     }
     if (isset($this->current_group->user_has_access)) {
         do_action('groups_setup_nav', $this->current_group->user_has_access);
     } else {
         do_action('groups_setup_nav');
     }
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:59,代码来源:bp-groups-loader.php

示例12: bp_legacy_theme_ajax_messages_star_handler

/**
 * AJAX callback to set a message's star status.
 *
 * @since BuddyPress (2.3.0)
 */
function bp_legacy_theme_ajax_messages_star_handler()
{
    if (false === bp_is_active('messages', 'star') || empty($_POST['message_id'])) {
        return;
    }
    // Check nonce
    check_ajax_referer('bp-messages-star-' . (int) $_POST['message_id'], 'nonce');
    // Check capability
    if (!is_user_logged_in() || !bp_core_can_edit_settings()) {
        return;
    }
    if (true === bp_messages_star_set_action(array('action' => $_POST['star_status'], 'message_id' => (int) $_POST['message_id'], 'bulk' => !empty($_POST['bulk']) ? true : false))) {
        echo '1';
        die;
    }
    echo '-1';
    die;
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:23,代码来源:buddypress-functions.php

示例13: setup_nav

 /**
  * Set up navigation for user pages.
  *
  * @param array $main_nav See {BP_Component::setup_nav()} for details.
  * @param array $sub_nav  See {BP_Component::setup_nav()} for details.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $access = bp_core_can_edit_settings();
     $slug = bp_get_messages_slug();
     $messages_link = trailingslashit($user_domain . $slug);
     // Only grab count if we're on a user page and current user has access
     if (bp_is_user() && bp_user_has_access()) {
         $count = bp_get_total_unread_messages_count();
         $class = 0 === $count ? 'no-count' : 'count';
         $nav_name = sprintf(__('Messages <span class="%s">%s</span>', 'buddypress'), esc_attr($class), bp_core_number_format($count));
     } else {
         $nav_name = __('Messages', 'buddypress');
     }
     // Add 'Messages' to the main navigation
     $main_nav = array('name' => $nav_name, 'slug' => $slug, 'position' => 50, 'show_for_displayed_user' => $access, 'screen_function' => 'messages_screen_inbox', 'default_subnav_slug' => 'inbox', 'item_css_id' => $this->id);
     // Add the subnav items to the profile
     $sub_nav[] = array('name' => __('Inbox', 'buddypress'), 'slug' => 'inbox', 'parent_url' => $messages_link, 'parent_slug' => $slug, 'screen_function' => 'messages_screen_inbox', 'position' => 10, 'user_has_access' => $access);
     if (bp_is_active($this->id, 'star')) {
         $sub_nav[] = array('name' => __('Starred', 'buddypress'), 'slug' => bp_get_messages_starred_slug(), 'parent_url' => $messages_link, 'parent_slug' => $slug, 'screen_function' => 'bp_messages_star_screen', 'position' => 11, 'user_has_access' => $access);
     }
     $sub_nav[] = array('name' => __('Sent', 'buddypress'), 'slug' => 'sentbox', 'parent_url' => $messages_link, 'parent_slug' => $slug, 'screen_function' => 'messages_screen_sentbox', 'position' => 20, 'user_has_access' => $access);
     $sub_nav[] = array('name' => __('Compose', 'buddypress'), 'slug' => 'compose', 'parent_url' => $messages_link, 'parent_slug' => $slug, 'screen_function' => 'messages_screen_compose', 'position' => 30, 'user_has_access' => $access);
     if (bp_current_user_can('bp_moderate')) {
         $sub_nav[] = array('name' => __('Notices', 'buddypress'), 'slug' => 'notices', 'parent_url' => $messages_link, 'parent_slug' => $slug, 'screen_function' => 'messages_screen_notices', 'position' => 90, 'user_has_access' => true);
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:41,代码来源:bp-messages-loader.php

示例14: setup_nav

 /**
  * Set up component navigation.
  *
  * @since 1.5.0
  *
  * @see BP_Component::setup_nav() for a description of arguments.
  *
  * @param array $main_nav Optional. See BP_Component::setup_nav() for description.
  * @param array $sub_nav  Optional. See BP_Component::setup_nav() for description.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Determine user to use.
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         $user_domain = false;
     }
     // Only grab count if we're on a user page.
     if (bp_is_user()) {
         $count = bp_get_total_group_count_for_user();
         $class = 0 === $count ? 'no-count' : 'count';
         $nav_name = sprintf(_x('Groups <span class="%s">%s</span>', 'Group screen nav with counter', 'buddypress'), esc_attr($class), bp_core_number_format($count));
     } else {
         $nav_name = _x('Groups', 'Group screen nav without counter', 'buddypress');
     }
     $slug = bp_get_groups_slug();
     // Add 'Groups' to the main navigation.
     $main_nav = array('name' => $nav_name, 'slug' => $slug, 'position' => 70, 'screen_function' => 'groups_screen_my_groups', 'default_subnav_slug' => 'my-groups', 'item_css_id' => $this->id);
     if (!empty($user_domain)) {
         $access = bp_core_can_edit_settings();
         $groups_link = trailingslashit($user_domain . $slug);
         // Add the My Groups nav item.
         $sub_nav[] = array('name' => __('Memberships', 'buddypress'), 'slug' => 'my-groups', 'parent_url' => $groups_link, 'parent_slug' => $slug, 'screen_function' => 'groups_screen_my_groups', 'position' => 10, 'item_css_id' => 'groups-my-groups');
         // Add the Group Invites nav item.
         $sub_nav[] = array('name' => __('Invitations', 'buddypress'), 'slug' => 'invites', 'parent_url' => $groups_link, 'parent_slug' => $slug, 'screen_function' => 'groups_screen_group_invites', 'user_has_access' => $access, 'position' => 30);
         parent::setup_nav($main_nav, $sub_nav);
     }
     if (bp_is_groups_component() && bp_is_single_item()) {
         // Reset sub nav.
         $sub_nav = array();
         // Add 'Groups' to the main navigation.
         $main_nav = array('name' => __('Memberships', 'buddypress'), 'slug' => $this->current_group->slug, 'position' => -1, 'screen_function' => 'groups_screen_group_home', 'default_subnav_slug' => $this->default_extension, 'item_css_id' => $this->id);
         $group_link = bp_get_group_permalink($this->current_group);
         // Add the "Home" subnav item, as this will always be present.
         $sub_nav[] = array('name' => _x('Home', 'Group screen navigation title', 'buddypress'), 'slug' => 'home', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_home', 'position' => 10, 'item_css_id' => 'home');
         // If this is a private group, and the user is not a
         // member and does not have an outstanding invitation,
         // show a "Request Membership" nav item.
         if (is_user_logged_in() && !$this->current_group->is_user_member && !groups_check_for_membership_request(bp_loggedin_user_id(), $this->current_group->id) && $this->current_group->status == 'private' && !groups_check_user_has_invite(bp_loggedin_user_id(), $this->current_group->id)) {
             $sub_nav[] = array('name' => _x('Request Membership', 'Group screen nav', 'buddypress'), 'slug' => 'request-membership', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_request_membership', 'position' => 30);
         }
         // Forums are enabled and turned on.
         if ($this->current_group->enable_forum && bp_is_active('forums')) {
             $sub_nav[] = array('name' => _x('Forum', 'My Group screen nav', 'buddypress'), 'slug' => 'forum', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_forum', 'position' => 40, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'forums');
         }
         if ($this->current_group->front_template || bp_is_active('activity')) {
             /**
              * If the theme is using a custom front, create activity subnav.
              */
             if ($this->current_group->front_template && bp_is_active('activity')) {
                 $sub_nav[] = array('name' => _x('Activity', 'My Group screen nav', 'buddypress'), 'slug' => 'activity', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_activity', 'position' => 11, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'activity', 'no_access_url' => $group_link);
             }
             /**
              * Only add the members subnav if it's not the home's nav.
              */
             $sub_nav[] = array('name' => sprintf(_x('Members %s', 'My Group screen nav', 'buddypress'), '<span>' . number_format($this->current_group->total_member_count) . '</span>'), 'slug' => 'members', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_members', 'position' => 60, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'members', 'no_access_url' => $group_link);
         }
         if (bp_is_active('friends') && bp_groups_user_can_send_invites()) {
             $sub_nav[] = array('name' => _x('Send Invites', 'My Group screen nav', 'buddypress'), 'slug' => 'send-invites', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_invite', 'item_css_id' => 'invite', 'position' => 70, 'user_has_access' => $this->current_group->user_has_access, 'no_access_url' => $group_link);
         }
         // If the user is a group admin, then show the group admin nav item.
         if (bp_is_item_admin()) {
             $sub_nav[] = array('name' => _x('Manage', 'My Group screen nav', 'buddypress'), 'slug' => 'admin', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_admin', 'position' => 1000, 'user_has_access' => true, 'item_css_id' => 'admin', 'no_access_url' => $group_link);
             $admin_link = trailingslashit($group_link . 'admin');
             // Common params to all nav items.
             $default_params = array('parent_url' => $admin_link, 'parent_slug' => $this->current_group->slug . '_manage', 'screen_function' => 'groups_screen_group_admin', 'user_has_access' => bp_is_item_admin(), 'show_in_admin_bar' => true);
             $sub_nav[] = array_merge(array('name' => __('Details', 'buddypress'), 'slug' => 'edit-details', 'position' => 0), $default_params);
             $sub_nav[] = array_merge(array('name' => __('Settings', 'buddypress'), 'slug' => 'group-settings', 'position' => 10), $default_params);
             if (!bp_disable_group_avatar_uploads() && buddypress()->avatar->show_avatars) {
                 $sub_nav[] = array_merge(array('name' => __('Photo', 'buddypress'), 'slug' => 'group-avatar', 'position' => 20), $default_params);
             }
             if (bp_group_use_cover_image_header()) {
                 $sub_nav[] = array_merge(array('name' => __('Cover Image', 'buddypress'), 'slug' => 'group-cover-image', 'position' => 25), $default_params);
             }
             $sub_nav[] = array_merge(array('name' => __('Members', 'buddypress'), 'slug' => 'manage-members', 'position' => 30), $default_params);
             if ('private' == $this->current_group->status) {
                 $sub_nav[] = array_merge(array('name' => __('Requests', 'buddypress'), 'slug' => 'membership-requests', 'position' => 40), $default_params);
             }
             $sub_nav[] = array_merge(array('name' => __('Delete', 'buddypress'), 'slug' => 'delete-group', 'position' => 1000), $default_params);
         }
         parent::setup_nav($main_nav, $sub_nav);
     }
     if (isset($this->current_group->user_has_access)) {
         /**
          * Fires at the end of the groups navigation setup if user has access.
          *
          * @since 1.0.2
//.........这里部分代码省略.........
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:101,代码来源:bp-groups-loader.php

示例15: setup_settings_nav

 /**
  * Set up the Settings > Profile nav item.
  *
  * Loaded in a separate method because the Settings component may not
  * be loaded in time for BP_XProfile_Component::setup_nav().
  *
  * @since BuddyPress (2.1.0)
  */
 public function setup_settings_nav()
 {
     if (!bp_is_active('settings')) {
         return;
     }
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     // Get the settings slug
     $settings_slug = bp_get_settings_slug();
     bp_core_new_subnav_item(array('name' => _x('Profile Visibility', 'Profile settings sub nav', 'buddypress'), 'slug' => 'profile', 'parent_url' => trailingslashit($user_domain . $settings_slug), 'parent_slug' => $settings_slug, 'screen_function' => 'bp_xprofile_screen_settings', 'position' => 30, 'user_has_access' => bp_core_can_edit_settings()));
 }
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:25,代码来源:bp-xprofile-loader.php


注:本文中的bp_core_can_edit_settings函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。