• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bp_is_current_component函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: user_profile_url

 /**
  * Override bbPress profile URL with BuddyPress profile URL
  *
  * @since bbPress (r3401)
  * @param string $url
  * @param int $user_id
  * @param string $user_nicename
  * @return string
  */
 public function user_profile_url($user_id)
 {
     // Define local variable(s)
     $profile_url = '';
     // Special handling for forum component
     if (bp_is_current_component('forums')) {
         // Empty action or 'topics' action
         if (!bp_current_action() || bp_is_current_action('topics')) {
             $profile_url = bp_core_get_user_domain($user_id) . 'forums/topics';
             // Empty action or 'topics' action
         } elseif (bp_is_current_action('replies')) {
             $profile_url = bp_core_get_user_domain($user_id) . 'forums/replies';
             // 'favorites' action
         } elseif (bbp_is_favorites_active() && bp_is_current_action('favorites')) {
             $profile_url = $this->get_favorites_permalink('', $user_id);
             // 'subscriptions' action
         } elseif (bbp_is_subscriptions_active() && bp_is_current_action('subscriptions')) {
             $profile_url = $this->get_subscriptions_permalink('', $user_id);
         }
         // Not in users' forums area
     } else {
         $profile_url = bp_core_get_user_domain($user_id);
     }
     return trailingslashit($profile_url);
 }
开发者ID:hscale,项目名称:webento,代码行数:34,代码来源:members.php


示例2: mpp_is_gallery_component

/**
 * Are we on Gallery Directory or User Gallery Pages?
 * 
 * @return boolean
 */
function mpp_is_gallery_component()
{
    if (function_exists('bp_is_current_component') && bp_is_current_component('mediapress')) {
        return true;
    }
    return false;
}
开发者ID:markc,项目名称:mediapress,代码行数:12,代码来源:mpp-gallery-conditionals.php


示例3: mpp_is_gallery_component

/**
 * Are we on Gallery Directory or User Gallery Pages?
 * 
 * @return boolean
 */
function mpp_is_gallery_component()
{
    if (bp_is_current_component('mediapress')) {
        return true;
    }
    return false;
}
开发者ID:baden03,项目名称:mediapress,代码行数:12,代码来源:conditionals.php


示例4: setup_filters

 /**
  * Set filters
  *
  * @package Rendez Vous
  * @subpackage Screens
  *
  * @since Rendez Vous (1.0.0)
  */
 private function setup_filters()
 {
     if (bp_is_current_component('rendez_vous')) {
         add_filter('bp_located_template', array($this, 'template_filter'), 20, 2);
         add_filter('bp_get_template_stack', array($this, 'add_to_template_stack'), 10, 1);
     }
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:15,代码来源:rendez-vous-screens.php


示例5: bp_core_action_set_spammer_status

/**
 * When a site admin selects "Mark as Spammer/Not Spammer" from the admin menu
 * this action will fire and mark or unmark the user and their blogs as spam.
 * Must be a site admin for this function to run.
 *
 * @package BuddyPress Core
 * @param int $user_id Optional user ID to mark as spam
 * @global object $nxtdb Global NXTClass Database object
 */
function bp_core_action_set_spammer_status($user_id = 0)
{
    // Use displayed user if it's not yourself
    if (empty($user_id)) {
        $user_id = bp_displayed_user_id();
    }
    if (bp_is_current_component('admin') && in_array(bp_current_action(), array('mark-spammer', 'unmark-spammer'))) {
        // Check the nonce
        check_admin_referer('mark-unmark-spammer');
        // To spam or not to spam
        $status = bp_is_current_action('mark-spammer') ? 'spam' : 'ham';
        // The heavy lifting
        bp_core_process_spammer_status($user_id, $status);
        // Add feedback message. @todo - Error reporting
        if ('spam' == $status) {
            bp_core_add_message(__('User marked as spammer. Spam users are visible only to site admins.', 'buddypress'));
        } else {
            bp_core_add_message(__('User removed as spammer.', 'buddypress'));
        }
        // Deprecated. Use bp_core_process_spammer_status.
        $is_spam = 'spam' == $status;
        do_action('bp_core_action_set_spammer_status', bp_displayed_user_id(), $is_spam);
        // Redirect back to where we came from
        bp_core_redirect(nxt_get_referer());
    }
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:35,代码来源:bp-members-actions.php


示例6: infinity_bp_nav_inject_options_filter

/**
 * Inject options nav onto end of active displayed user nav component
 *
 * @param string $html
 * @param array $user_nav_item
 * @return string
 */
function infinity_bp_nav_inject_options_filter($html, $user_nav_item)
{
    // slug of nav item being filtered
    $component = $user_nav_item['slug'];
    // show options nav?
    $show = bp_is_current_component($component);
    // special hack to handle profile in BP versions < 1.7
    if ('profile' == $component && -1 == version_compare(BP_VERSION, '1.7') && false == bp_is_my_profile()) {
        // force hide it
        $show = false;
    }
    // filter the show var because i love developers
    $show = (bool) apply_filters('infinity_bp_nav_inject_options_show', $show, $user_nav_item);
    // ok, finally... should we show it?
    if (true === $show) {
        // yes, need to capture options nav output
        ob_start();
        // run options nav template tag
        bp_get_options_nav();
        // grab buffer and wipe it
        $nav = trim((string) ob_get_clean());
        // make sure the result has some meat
        if ('' != $nav) {
            // yep, inject options nav onto end of list item wrapped in special <ul>
            return preg_replace('/(<\\/li>.*)$/', '<ul class="profile-subnav">' . $nav . '</ul>$1', $html, 1);
        }
    }
    // no changes
    return $html;
}
开发者ID:shads196770,项目名称:cbox-theme,代码行数:37,代码来源:menus.php


示例7: bp_core_action_delete_user

/**
 * Process user deletion requests.
 *
 * Note: No longer called here. See the Settings component.
 */
function bp_core_action_delete_user()
{
    $userID = bp_displayed_user_id();
    echo "Buddypress:";
    echo $userID;
    $now = current_time('mysql');
    $args = array('date_query' => array('after' => '5 minute ago', 'before' => $now, 'inclusive' => true), 'post_id' => $postID, 'user_id' => $userID, 'count' => true);
    $userActivityCount = get_comments($args);
    if (!bp_current_user_can('bp_moderate') || bp_is_my_profile() || !bp_displayed_user_id() || $userActivityCount != 0) {
        return false;
    }
    if (bp_is_current_component('admin') && bp_is_current_action('delete-user') && $userActivityCount == 0) {
        // Check the nonce.
        check_admin_referer('delete-user');
        $errors = false;
        $style = "<style> #account-delete-form .submit{ display:none !important;} </style>";
        if ($userActivityCount != 0) {
            $errors = true;
            return $style;
        }
        do_action('bp_core_before_action_delete_user', $errors);
        if (bp_core_delete_account(bp_displayed_user_id()) || $userActivityCount == 0) {
            bp_core_add_message(sprintf(__('%s has been deleted from the system.', 'buddypress'), bp_get_displayed_user_fullname()));
        } else {
            bp_core_add_message(sprintf(__('There was an error deleting %s from the system. Please try again.', 'buddypress'), bp_get_displayed_user_fullname()), 'error');
            $errors = true;
        }
        do_action('bp_core_action_delete_user', $errors);
        if ($errors) {
            bp_core_redirect(bp_displayed_user_domain());
        } else {
            bp_core_redirect(bp_loggedin_user_domain());
        }
    }
}
开发者ID:ashpriom,项目名称:wp-auction,代码行数:40,代码来源:bp-members-actions.php


示例8: bp_compliments_load_template_filter

/**
 * Filters template for the user compliments tab.
 *
 * @since 0.0.1
 * @package BuddyPress_Compliments
 *
 * @global object $bp BuddyPress instance.
 * @param string $found_template Located template file.
 * @param array $templates The template array.
 * @return string Template file.
 */
function bp_compliments_load_template_filter($found_template, $templates)
{
    global $bp;
    // Only filter the template location when we're on the compliments component pages.
    if (!bp_is_current_component($bp->compliments->compliments->slug)) {
        return $found_template;
    }
    if (empty($found_template)) {
        bp_register_template_stack('bp_compliments_get_template_directory', 14);
        // locate_template() will attempt to find the plugins.php template in the
        // child and parent theme and return the located template when found
        //
        // plugins.php is the preferred template to use, since all we'd need to do is
        // inject our content into BP
        //
        // note: this is only really relevant for bp-default themes as theme compat
        // will kick in on its own when this template isn't found
        $found_template = locate_template('members/single/plugins.php', false, false);
        // add our hook to inject content into BP
        add_action('bp_template_content', 'bp_compliments_single_compliments_content');
    }
    /**
     * Filters the compliment page template.
     *
     * @since 0.0.1
     * @package BuddyPress_Compliments
     *
     * @param string $found_template Located template file.
     */
    return apply_filters('bp_compliments_load_template_filter', $found_template);
}
开发者ID:kprajapatii,项目名称:buddypress-compliments,代码行数:42,代码来源:bp-compliments-screens.php


示例9: check_legacy

 public function check_legacy($tpl)
 {
     $status = function_exists('buddypress');
     if (!$status) {
         return $tpl;
     }
     $this->bp_plugin_name = bp_get_name_from_root_slug();
     // This check fails for some plugins
     // $status = $this->bp_plugin_name != false;
     if ($status) {
         $bp_defaults = array('members', 'xprofile', 'activity', 'blogs', 'messages', 'friends', 'groups', 'forums', 'settings');
         foreach ($bp_defaults as $bp_default) {
             if (bp_is_current_component($bp_default)) {
                 break;
             }
         }
     }
     if ($status && bp_is_directory()) {
         $this->is_legacy = $status = false;
     }
     if ($status && false === (bool) locate_template(array('members/single/item-header.php'), false)) {
         add_action('wp_footer', array($this, 'item_header'));
     }
     if ($status) {
         add_action('wp_footer', array($this, 'page_title'));
         add_action('wp_footer', array($this, 'echo_legacy_tpl'));
     }
     return $tpl;
 }
开发者ID:tvolmari,项目名称:hammydowns,代码行数:29,代码来源:bp-legacy-loader.php


示例10: bp_checkins_if_category_place

function bp_checkins_if_category_place()
{
    if (!bp_displayed_user_id() && bp_is_current_component('checkins') && bp_is_current_action('place') && bp_action_variable(0) && 'category' == bp_action_variable(0) && bp_action_variable(1)) {
        return true;
    } else {
        return false;
    }
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:8,代码来源:bp-checkins-functions.php


示例11: bcg_is_component

/**
 * Are we dealing with blog categories pages?
 * @return type 
 */
function bcg_is_component()
{
    $bp = buddypress();
    if (bp_is_current_component($bp->groups->slug) && bp_is_current_action(BCG_SLUG)) {
        return true;
    }
    return false;
}
开发者ID:WP--plugins,项目名称:blog-categories-for-groups,代码行数:12,代码来源:bcg-functions.php


示例12: bp_core_new_nav_item

/**
 * Adds a navigation item to the main navigation array used in BuddyPress themes.
 *
 * @package BuddyPress Core
 * @global object $bp Global BuddyPress settings object
 */
function bp_core_new_nav_item($args = '')
{
    global $bp;
    $defaults = array('name' => false, 'slug' => false, 'item_css_id' => false, 'show_for_displayed_user' => true, 'site_admin_only' => false, 'position' => 99, 'screen_function' => false, 'default_subnav_slug' => false);
    $r = nxt_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    // If we don't have the required info we need, don't create this subnav item
    if (empty($name) || empty($slug)) {
        return false;
    }
    // If this is for site admins only and the user is not one, don't create the subnav item
    if ($site_admin_only && !is_super_admin()) {
        return false;
    }
    if (empty($item_css_id)) {
        $item_css_id = $slug;
    }
    $bp->bp_nav[$slug] = array('name' => $name, 'slug' => $slug, 'link' => $bp->loggedin_user->domain . $slug . '/', 'css_id' => $item_css_id, 'show_for_displayed_user' => $show_for_displayed_user, 'position' => $position, 'screen_function' => &$screen_function);
    /***
     * If this nav item is hidden for the displayed user, and
     * the logged in user is not the displayed user
     * looking at their own profile, don't create the nav item.
     */
    if (!$show_for_displayed_user && !bp_user_has_access()) {
        return false;
    }
    /***
     * If the nav item is visible, we are not viewing a user, and this is a root
     * component, don't attach the default subnav function so we can display a
     * directory or something else.
     */
    if (-1 != $position && bp_is_root_component($slug) && !bp_displayed_user_id()) {
        return;
    }
    // Look for current component
    if (bp_is_current_component($slug) && !bp_current_action()) {
        if (!is_object($screen_function[0])) {
            add_action('bp_screens', $screen_function);
        } else {
            add_action('bp_screens', array(&$screen_function[0], $screen_function[1]), 3);
        }
        if (!empty($default_subnav_slug)) {
            $bp->current_action = apply_filters('bp_default_component_subnav', $default_subnav_slug, $r);
        }
        // Look for current item
    } elseif (bp_is_current_item($slug) && !bp_current_action()) {
        if (!is_object($screen_function[0])) {
            add_action('bp_screens', $screen_function);
        } else {
            add_action('bp_screens', array(&$screen_function[0], $screen_function[1]), 3);
        }
        if (!empty($default_subnav_slug)) {
            $bp->current_action = apply_filters('bp_default_component_subnav', $default_subnav_slug, $r);
        }
    }
    do_action('bp_core_new_nav_item', $r, $args, $defaults);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:63,代码来源:bp-core-buddybar.php


示例13: is_bp_plugin

 public function is_bp_plugin()
 {
     if (bp_is_current_component('articles')) {
         // first we reset the post
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post'));
         // then we filter ‘the_content’ thanks to bp_replace_the_content
         add_filter('bp_replace_the_content', array($this, 'directory_content'));
     }
 }
开发者ID:Dannypid,项目名称:Tinymce-social-articles-1.8,代码行数:9,代码来源:social-articles-screens.php


示例14: members_please_log_in

/**
 * Redirects users that are not logged in to the 'wp-login.php' page.
 *
 * @since 0.1.0
 * @uses is_user_logged_in() Checks if the current user is logged in.
 * @uses auth_redirect() Redirects people that are not logged in to the login page.
 */
function members_please_log_in()
{
    /* Check if the private blog feature is active. */
    if (members_get_setting('private_blog')) {
        /* If using BuddyPress and on the register page, don't do anything. */
        if (function_exists('bp_is_current_component') && bp_is_current_component('register')) {
            return;
        } elseif (!is_user_logged_in()) {
            auth_redirect();
        }
    }
}
开发者ID:fwelections,项目名称:fwelections,代码行数:19,代码来源:private-site.php


示例15: members_please_log_in

/**
 * Redirects users that are not logged in to the 'wp-login.php' page.
 *
 * @since  0.1.0
 * @access public
 * @return void
 */
function members_please_log_in()
{
    // Check if the private blog feature is active and if the user is not logged in.
    if (members_is_private_blog() && !is_user_logged_in()) {
        // If using BuddyPress and on the register page, don't do anything.
        if (function_exists('bp_is_current_component') && bp_is_current_component('register')) {
            return;
        }
        // Redirect to the login page.
        auth_redirect();
        exit;
    }
}
开发者ID:gecugamo,项目名称:customledgers,代码行数:20,代码来源:functions-private-site.php


示例16: fix_registration

 /**
  * Fixes the ProSites checkout if BuddyPress registration page is set to checkout page
  */
 public static function fix_registration()
 {
     global $psts;
     if (function_exists('bp_core_get_directory_page_ids')) {
         $bp_directory_page_ids = bp_core_get_directory_page_ids();
         if (!empty($bp_directory_page_ids['register'])) {
             $register_url = get_permalink($bp_directory_page_ids['register']);
         }
         if (bp_is_current_component('register') && $register_url == $psts->checkout_url()) {
             remove_action('bp_init', 'bp_core_wpsignup_redirect');
             remove_action('bp_screens', 'bp_core_screen_signup');
         }
     }
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:17,代码来源:BuddyPress.php


示例17: dpa_add_js

/**
 * Enqueues JavaScript files.
 *
 * @since 2.0
 * @global object $bp BuddyPress global settings
 */
function dpa_add_js()
{
    global $bp;
    if (!bp_is_current_component($bp->achievements->slug)) {
        return;
    }
    if (DPA_SLUG_CREATE == $bp->current_action && dpa_permission_can_user_create() || DPA_SLUG_ACHIEVEMENT_EDIT == $bp->current_action && dpa_permission_can_user_edit() || DPA_SLUG_ACHIEVEMENT_CHANGE_PICTURE == $bp->current_action && dpa_permission_can_user_change_picture() || DPA_SLUG_ACHIEVEMENT_GRANT == $bp->current_action && dpa_permission_can_user_grant()) {
        nxt_enqueue_script('achievements-admin-js', plugins_url('/js/admin.js', __FILE__), array(), ACHIEVEMENTS_VERSION);
    }
    if ($bp->is_single_item) {
        nxt_enqueue_script('achievements-detail-js', plugins_url('/js/detail.js', __FILE__), array(), ACHIEVEMENTS_VERSION);
    } else {
        nxt_enqueue_script('achievements-directory-js', plugins_url('/js/directory.js', __FILE__), array(), ACHIEVEMENTS_VERSION);
    }
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:21,代码来源:achievements-cssjs.php


示例18: bp_follow_load_template_filter

/**
 * BP Follow template loader.
 *
 * This function sets up BP Follow to use custom templates.
 *
 * If a template does not exist in the current theme, we will use our own
 * bundled templates.
 *
 * We're doing two things here:
 *  1) Support the older template format for themes that are using them
 *     for backwards-compatibility (the template passed in
 *     {@link bp_core_load_template()}).
 *  2) Route older template names to use our new template locations and
 *     format.
 *
 * View the inline doc for more details.
 *
 * @since 1.0
 */
function bp_follow_load_template_filter($found_template, $templates)
{
    global $bp;
    // Only filter the template location when we're on the follow component pages.
    if (!bp_is_current_component($bp->follow->followers->slug) && !bp_is_current_component($bp->follow->following->slug)) {
        return $found_template;
    }
    // $found_template is not empty when the older template files are found in the
    // parent and child theme
    //
    //  /wp-content/themes/YOUR-THEME/members/single/following.php
    //  /wp-content/themes/YOUR-THEME/members/single/followers.php
    //
    // The older template files utilize a full template ( get_header() +
    // get_footer() ), which sucks for themes and theme compat.
    //
    // When the older template files are not found, we use our new template method,
    // which will act more like a template part.
    if (empty($found_template)) {
        // register our theme compat directory
        //
        // this tells BP to look for templates in our plugin directory last
        // when the template isn't found in the parent / child theme
        bp_register_template_stack('bp_follow_get_template_directory', 14);
        // locate_template() will attempt to find the plugins.php template in the
        // child and parent theme and return the located template when found
        //
        // plugins.php is the preferred template to use, since all we'd need to do is
        // inject our content into BP
        //
        // note: this is only really relevant for bp-default themes as theme compat
        // will kick in on its own when this template isn't found
        $found_template = locate_template('members/single/plugins.php', false, false);
        // add AJAX support to the members loop
        // can disable with the 'bp_follow_allow_ajax_on_follow_pages' filter
        if (apply_filters('bp_follow_allow_ajax_on_follow_pages', true)) {
            // add the "Order by" dropdown filter
            add_action('bp_member_plugin_options_nav', 'bp_follow_add_members_dropdown_filter');
            // add ability to use AJAX
            add_action('bp_after_member_plugin_template', 'bp_follow_add_ajax_to_members_loop');
        }
        // add our hook to inject content into BP
        //
        // note the new template name for our template part
        add_action('bp_template_content', create_function('', "\n\t\t\tbp_get_template_part( 'members/single/follow' );\n\t\t"));
    }
    return apply_filters('bp_follow_load_template_filter', $found_template);
}
开发者ID:vilmark,项目名称:vilmark_main,代码行数:67,代码来源:bp-follow-screens.php


示例19: social_articles_load_template_filter

function social_articles_load_template_filter($found_template, $templates)
{
    global $bp;
    if (!bp_sa_is_bp_default() || !bp_is_current_component($bp->social_articles->slug)) {
        return $found_template;
    }
    foreach ((array) $templates as $template) {
        if (file_exists(STYLESHEETPATH . '/' . $template)) {
            $filtered_templates[] = STYLESHEETPATH . '/' . $template;
        } else {
            $filtered_templates[] = dirname(__FILE__) . '/templates/' . $template;
        }
    }
    $found_template = $filtered_templates[0];
    return apply_filters('social_articles_load_template_filter', $found_template);
}
开发者ID:Dannypid,项目名称:Tinymce-social-articles-1.8,代码行数:16,代码来源:social-articles-functions.php


示例20: 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;
             }
         }
     }
 }
开发者ID:andreuka,项目名称:buddypress-block-user,代码行数:22,代码来源:class-BPBlockUser.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP bp_is_deactivation函数代码示例发布时间:2022-05-24
下一篇:
PHP bp_is_current_action函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap