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


PHP bp_is_user函数代码示例

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


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

示例1: item_info

 /**
  * @since 2.6.1
  * Public $item_info
  * Oget the post location information from database
  */
 public function item_info()
 {
     global $members_template;
     if (is_single() && empty($this->args['show_in_single_post'])) {
         $this->args['no_location_message'] = false;
     }
     if (empty($this->args['item_id']) && empty($members_template->member->ID) && !bp_is_user() && (!is_single() || empty($this->args['show_in_single_post']))) {
         return false;
     }
     if (!empty($this->args['item_id'])) {
         $this->args['item_id'] = $this->args['item_id'];
     } elseif (bp_is_user()) {
         global $bp;
         $this->args['item_id'] = $bp->displayed_user->id;
     } elseif (is_single()) {
         global $post;
         $this->args['item_id'] = $post->post_author;
     } elseif (!empty($members_template->member->ID)) {
         $this->args['item_id'] = $members_template->member->ID;
     } else {
         return false;
     }
     $item_info = gmw_get_member_info_from_db($this->args['item_id']);
     return $item_info;
 }
开发者ID:ankushpofale,项目名称:findyouneed-testing-,代码行数:30,代码来源:gmw-fl-single-member-location-class.php

示例2: setup_nav

 /**
  * Set up component navigation.
  *
  * @since BuddyPress (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())
 {
     // 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), number_format_i18n($count));
     } else {
         $nav_name = _x('Notifications', 'Profile screen nav', 'buddypress');
     }
     // Add 'Notifications' to the main navigation
     $main_nav = array('name' => $nav_name, 'slug' => $this->slug, 'position' => 30, 'show_for_displayed_user' => bp_core_can_edit_settings(), 'screen_function' => 'bp_notifications_screen_unread', 'default_subnav_slug' => 'unread', '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;
     }
     $notifications_link = trailingslashit($user_domain . bp_get_notifications_slug());
     // 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' => bp_get_notifications_slug(), 'screen_function' => 'bp_notifications_screen_unread', 'position' => 10, 'item_css_id' => 'notifications-my-notifications', 'user_has_access' => bp_core_can_edit_settings());
     $sub_nav[] = array('name' => _x('Read', 'Notification screen nav', 'buddypress'), 'slug' => 'read', 'parent_url' => $notifications_link, 'parent_slug' => bp_get_notifications_slug(), 'screen_function' => 'bp_notifications_screen_read', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:38,代码来源:bp-notifications-loader.php

示例3: is_blogs

 /**
  * Are we looking at something that needs Blogs theme compatibility?
  *
  * @since 1.7.0
  */
 public function is_blogs()
 {
     // Bail if not looking at a group.
     if (!bp_is_blogs_component()) {
         return;
     }
     // Bail if looking at a users sites.
     if (bp_is_user()) {
         return;
     }
     // Blog Directory.
     if (is_multisite() && !bp_current_action()) {
         bp_update_is_directory(true, 'blogs');
         /**
          * Fires if in the blog directory and BuddyPress needs Blog theme compatibility,
          * before the actions and filters are added.
          *
          * @since 1.5.0
          */
         do_action('bp_blogs_screen_index');
         add_filter('bp_get_buddypress_template', array($this, 'directory_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'directory_content'));
         // Create blog.
     } elseif (is_user_logged_in() && bp_blog_signup_enabled()) {
         add_filter('bp_get_buddypress_template', array($this, 'create_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'create_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'create_content'));
     }
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:35,代码来源:class-bp-blogs-theme-compat.php

示例4: 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') . '");')));
}
开发者ID:hornetalcala,项目名称:trunk,代码行数:36,代码来源:bp-members-adminbar.php

示例5: mpp_is_user_gallery_component

/**
 * Is it User Gallery component?
 * @return boolean
 */
function mpp_is_user_gallery_component()
{
    if (function_exists('bp_is_user') && bp_is_user() && mpp_is_gallery_component()) {
        return true;
    }
    return false;
}
开发者ID:markc,项目名称:mediapress,代码行数:11,代码来源:mpp-gallery-conditionals.php

示例6: mpp_is_user_gallery_component

/**
 * Is it User Gallery component?
 * @return boolean
 */
function mpp_is_user_gallery_component()
{
    if (bp_is_user() && mpp_is_gallery_component()) {
        return true;
    }
    return false;
}
开发者ID:baden03,项目名称:mediapress,代码行数:11,代码来源:conditionals.php

示例7: bbp_filter_is_single_user

/**
 * Filter the bbPress is_single_user function with BuddyPress eqivalent
 *
 * @since bbPress (r3552)
 *
 * @param bool $is Optional. Default false
 * @return bool True if viewing single user, false if not
 */
function bbp_filter_is_single_user($is = false)
{
    if (!empty($is)) {
        return $is;
    }
    return bp_is_user();
}
开发者ID:hscale,项目名称:webento,代码行数:15,代码来源:functions.php

示例8: has_access

 /**
  * Verify access to the current content.
  *
  * Related:
  * A reference of available BuddyPress template tags
  * https://codex.buddypress.org/developer/template-tag-reference/
  *
  * @since  1.0.0
  *
  * @param int $id The content post ID to verify access.
  * @return bool|null True if has access, false otherwise.
  *     Null means: Rule not relevant for current page.
  */
 public function has_access($id, $admin_has_access = true)
 {
     global $bp;
     $has_access = null;
     if (!function_exists('bp_current_component')) {
         return null;
     }
     if (is_buddypress()) {
         // Check if access to *all* BuddyPress pages is restricted
         $has_access = parent::has_access(MS_Addon_BuddyPress_Rule::PROTECT_ALL, $admin_has_access);
     }
     if ($has_access) {
         // General BuddyPress access is either *allowed* or *not denied*
         $component = bp_current_component();
         if (!empty($component)) {
             if ('members' == $component || bp_is_user()) {
                 // Member listing or member profile access.
                 $has_access = parent::has_access(MS_Addon_BuddyPress_Rule::PROTECT_MEMBERS, $admin_has_access);
             } elseif ('messages' == $component) {
                 // Private messaging direct access.
                 if ('compose' == $bp->current_action) {
                     $has_access = parent::has_access(MS_Addon_BuddyPress_Rule::PROTECT_PRIVATE_MSG, $admin_has_access);
                 }
             } elseif ('messages' == $component) {
                 // Don't modify, handled by MS_Addon_Buddypress_Rule_Group
             } else {
                 // Other BP pages can be handled by other rules.
                 $has_access = null;
             }
         }
     }
     return apply_filters('ms_rule_buddypress_has_access', $has_access, $id, $this);
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:46,代码来源:class-ms-addon-buddypress-rule-model.php

示例9: setup_nav

 /**
  * Setup BuddyBar navigation
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // 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), number_format_i18n($count));
     } else {
         $nav_name = __('Messages', 'buddypress');
     }
     // Add 'Messages' to the main navigation
     $main_nav = array('name' => $nav_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:danielcoats,项目名称:schoolpress,代码行数:34,代码来源:bp-messages-loader.php

示例10: mpp_current_component_id_for_user

function mpp_current_component_id_for_user($component_id)
{
    if (mediapress()->is_bp_active() && bp_is_user()) {
        return bp_displayed_user_id();
        //that is displayed user id
    }
    return $component_id;
}
开发者ID:markc,项目名称:mediapress,代码行数:8,代码来源:mpp-user-hooks.php

示例11: mpp_current_component_id_for_user

function mpp_current_component_id_for_user($component_id)
{
    if (bp_is_user()) {
        return bp_displayed_user_id();
    }
    //that is displayed user id
    return $component_id;
}
开发者ID:baden03,项目名称:mediapress,代码行数:8,代码来源:hooks.php

示例12: subscriptions_component

 function subscriptions_component()
 {
     if (bp_is_user()) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:8,代码来源:bbpress.php

示例13: bp_members_screen_index

/**
 * Handles the display of the members directory index
 *
 * @global object $bp
 *
 * @uses bp_is_user()
 * @uses bp_is_current_component()
 * @uses do_action()
 * @uses bp_core_load_template()
 * @uses apply_filters()
 */
function bp_members_screen_index()
{
    if (!bp_is_user() && bp_is_members_component()) {
        bp_update_is_directory(true, 'members');
        do_action('bp_members_screen_index');
        bp_core_load_template(apply_filters('bp_members_screen_index', 'members/index'));
    }
}
开发者ID:hornetalcala,项目名称:trunk,代码行数:19,代码来源:bp-members-screens.php

示例14: setup_nav

 public function setup_nav($main = array(), $sub = array())
 {
     $bp = buddypress();
     $component = 'members';
     $component_id = mpp_get_current_component_id();
     if (!mpp_is_enabled($component, $component_id)) {
         //allow to disable user galleries in case they don't want it
         return false;
     }
     $view_helper = MPP_Gallery_Screens::get_instance();
     // Add 'Gallery' to the user's main navigation
     $main_nav = array('name' => sprintf(__('Gallery <span>%d</span>', 'mediapress'), mpp_get_total_gallery_for_user()), 'slug' => $this->slug, 'position' => 86, 'screen_function' => array($view_helper, 'user_galleries'), 'default_subnav_slug' => 'my-galleries', 'item_css_id' => $this->id);
     if (bp_is_user()) {
         $user_domain = bp_displayed_user_domain();
     } else {
         $user_domain = bp_loggedin_user_domain();
     }
     $gallery_link = trailingslashit($user_domain . $this->slug);
     //with a trailing slash
     // Add the My Gallery nav item
     $sub_nav[] = array('name' => __('My Gallery', 'mediapress'), 'slug' => 'my-galleries', 'parent_url' => $gallery_link, 'parent_slug' => $this->slug, 'screen_function' => array($view_helper, 'my_galleries'), 'position' => 10, 'item_css_id' => 'gallery-my-gallery');
     if (mpp_user_can_create_gallery($component, get_current_user_id())) {
         // Add the Create gallery link to gallery nav
         $sub_nav[] = array('name' => __('Create a Gallery', 'mediapress'), 'slug' => 'create', 'parent_url' => $gallery_link, 'parent_slug' => $this->slug, 'screen_function' => array($view_helper, 'my_galleries'), 'user_has_access' => bp_is_my_profile(), 'position' => 20);
     }
     if (mpp_component_has_type_filters_enabled($component, $component_id)) {
         $i = 10;
         $supported_types = mpp_component_get_supported_types($component);
         foreach ($supported_types as $type) {
             if (!mpp_is_active_type($type)) {
                 continue;
             }
             $type_object = mpp_get_type_object($type);
             $sub_nav[] = array('name' => $type_object->label, 'slug' => 'type/' . $type, 'parent_url' => $gallery_link, 'parent_slug' => $this->slug, 'screen_function' => array($view_helper, 'my_galleries'), 'position' => 20 + $i);
             $i = $i + 10;
             //increment the position
         }
     }
     // Add the Upload link to gallery nav
     /*$sub_nav[] = array(
           'name'				=> __( 'Upload', 'mediapress'),
           'slug'				=> 'upload',
           'parent_url'		=> $gallery_link,
           'parent_slug'		=> $this->slug,
           'screen_function'	=> array( $view_helper, 'upload_media' ),
           'user_has_access'	=> bp_is_my_profile(),
           'position'			=> 30
       );*/
     parent::setup_nav($main_nav, $sub_nav);
     //disallow these names in various lists
     //we have yet to implement it
     $this->forbidden_names = apply_filters('mpp_forbidden_names', array('gallery', 'galleries', 'my-gallery', 'create', 'delete', 'upload', 'add', 'edit', 'admin', 'request', 'upload', 'tags', 'audio', 'video', 'photo'));
     //use this to extend the valid status
     $this->valid_status = apply_filters('mpp_valid_gallery_status', array_keys(mpp_get_active_statuses()));
     do_action('mpp_setup_nav');
     // $bp->gallery->current_gallery->user_has_access
 }
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:57,代码来源:mpp-bp-component.php

示例15: test_member_activity_page

 public function test_member_activity_page()
 {
     $url = home_url($this->u->user_nicename) . '/' . bp_get_activity_slug();
     $this->go_to($url);
     $this->assertTrue(bp_is_user());
     $this->assertTrue(bp_is_my_profile());
     $this->assertEquals($this->u->ID, bp_displayed_user_id());
     $this->assertTrue(bp_is_activity_component());
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:9,代码来源:root-profiles.php


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