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

PHP bp_is_current_action函数代码示例

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

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



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

示例1: bp_follow_blogs_add_activity_scope_filter

/**
 * Filter the activity loop.
 *
 * Specifically, when on the activity directory and clicking on the "Followed
 * Sites" tab.
 *
 * @param str $qs The querystring for the BP loop
 * @param str $object The current object for the querystring
 * @return str Modified querystring
 */
function bp_follow_blogs_add_activity_scope_filter($qs, $object)
{
    // not on the blogs object? stop now!
    if ($object != 'activity') {
        return $qs;
    }
    // parse querystring into an array
    $r = wp_parse_args($qs);
    if (bp_is_current_action(constant('BP_FOLLOW_BLOGS_USER_ACTIVITY_SLUG'))) {
        $r['scope'] = 'followblogs';
    }
    if (!isset($r['scope'])) {
        return $qs;
    }
    if ('followblogs' !== $r['scope']) {
        return $qs;
    }
    // get blog IDs that the user is following
    $following_ids = bp_get_following_ids(array('user_id' => bp_displayed_user_id() ? bp_displayed_user_id() : bp_loggedin_user_id(), 'follow_type' => 'blogs'));
    // if $following_ids is empty, pass a negative number so no blogs can be found
    $following_ids = empty($following_ids) ? -1 : $following_ids;
    $args = array('user_id' => 0, 'object' => 'blogs', 'primary_id' => $following_ids);
    // make sure we add a separator if we have an existing querystring
    if (!empty($qs)) {
        $qs .= '&';
    }
    // add our follow parameters to the end of the querystring
    $qs .= build_query($args);
    // support BP Groupblog
    // We need to filter the WHERE SQL conditions to do this
    if (function_exists('bp_groupblog_init')) {
        add_filter('bp_activity_get_where_conditions', 'bp_follow_blogs_groupblog_activity_where_conditions', 10, 2);
    }
    return $qs;
}
开发者ID:wesavetheworld,项目名称:buddypress-followers,代码行数:45,代码来源:blogs-backpat.php


示例2: 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


示例3: 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


示例4: messages_add_autocomplete_css

/**
 * Enqueue the CSS for messages autocomplete.
 *
 * @todo Why do we call wp_print_styles()?
 */
function messages_add_autocomplete_css()
{
    if (bp_is_messages_component() && bp_is_current_action('compose')) {
        wp_enqueue_style('bp-messages-autocomplete');
        wp_print_styles();
    }
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:12,代码来源:bp-messages-cssjs.php


示例5: friends_action_remove_friend

/**
 * Catch and process Remove Friendship requests.
 *
 * @since 1.0.1
 */
function friends_action_remove_friend()
{
    if (!bp_is_friends_component() || !bp_is_current_action('remove-friend')) {
        return false;
    }
    if (!($potential_friend_id = (int) bp_action_variable(0))) {
        return false;
    }
    if ($potential_friend_id == bp_loggedin_user_id()) {
        return false;
    }
    $friendship_status = BP_Friends_Friendship::check_is_friend(bp_loggedin_user_id(), $potential_friend_id);
    if ('is_friend' == $friendship_status) {
        if (!check_admin_referer('friends_remove_friend')) {
            return false;
        }
        if (!friends_remove_friend(bp_loggedin_user_id(), $potential_friend_id)) {
            bp_core_add_message(__('Friendship could not be canceled.', 'buddypress'), 'error');
        } else {
            bp_core_add_message(__('Friendship canceled', 'buddypress'));
        }
    } elseif ('is_friends' == $friendship_status) {
        bp_core_add_message(__('You are not yet friends with this user', 'buddypress'), 'error');
    } else {
        bp_core_add_message(__('You have a pending friendship request with this user', 'buddypress'), 'error');
    }
    bp_core_redirect(wp_get_referer());
    return false;
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:34,代码来源:bp-friends-actions.php


示例6: is_group

 /**
  * Are we looking at something that needs group theme compatibility?
  *
  * @since 1.7.0
  */
 public function is_group()
 {
     // Bail if not looking at a group.
     if (!bp_is_groups_component()) {
         return;
     }
     // Group Directory.
     if (!bp_current_action() && !bp_current_item()) {
         bp_update_is_directory(true, 'groups');
         /**
          * Fires at the start of the group theme compatibility setup.
          *
          * @since 1.1.0
          */
         do_action('groups_directory_groups_setup');
         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'));
         // Creating a group.
     } elseif (bp_is_groups_component() && bp_is_current_action('create')) {
         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'));
         // Group page.
     } elseif (bp_is_single_item()) {
         add_filter('bp_get_buddypress_template', array($this, 'single_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'single_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'single_content'));
     }
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:35,代码来源:class-bp-groups-theme-compat.php


示例7: bp_checkins_is_group_places_area

function bp_checkins_is_group_places_area()
{
    if (bp_is_groups_component() && bp_is_single_item() && bp_is_current_action('checkins') && bp_action_variable(0) == 'places') {
        return true;
    } else {
        return false;
    }
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:8,代码来源:bp-checkins-functions.php


示例8: bp_reshare_is_user_profile_reshares

function bp_reshare_is_user_profile_reshares()
{
    if (bp_is_activity_component() && bp_displayed_user_id() && bp_is_current_action('reshares')) {
        return true;
    } else {
        return false;
    }
}
开发者ID:KristianI,项目名称:bp-reshare,代码行数:8,代码来源:bp-reshare-functions.php


示例9: messages_add_autocomplete_css

function messages_add_autocomplete_css()
{
    if (bp_is_messages_component() && bp_is_current_action('compose')) {
        $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
        wp_enqueue_style('bp-messages-autocomplete', buddypress()->plugin_url . "bp-messages/css/autocomplete/jquery.autocompletefb{$min}.css", array(), bp_get_version());
        wp_print_styles();
    }
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:8,代码来源:bp-messages-cssjs.php


示例10: bp_chekins_allow_comments

function bp_chekins_allow_comments($retval, $open, $post_id)
{
    if (bp_is_current_component('checkins') && bp_is_current_action('place') && bp_action_variable(0)) {
        return $open;
    } else {
        return $retval;
    }
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:8,代码来源:bp-checkins-filters.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: messages_add_autocomplete_css

function messages_add_autocomplete_css()
{
    if (bp_is_messages_component() && bp_is_current_action('compose')) {
        if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
            wp_enqueue_style('bp-messages-autocomplete', BP_PLUGIN_URL . 'bp-messages/css/autocomplete/jquery.autocompletefb.dev.css', array(), bp_get_version());
        } else {
            wp_enqueue_style('bp-messages-autocomplete', BP_PLUGIN_URL . 'bp-messages/css/autocomplete/jquery.autocompletefb.css', array(), bp_get_version());
        }
        wp_print_styles();
    }
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:11,代码来源:bp-messages-cssjs.php


示例13: bp_blogs_screen_create_a_blog

/**
 * Load the "Create a Blog" screen.
 */
function bp_blogs_screen_create_a_blog()
{
    if (!is_multisite() || !bp_is_blogs_component() || !bp_is_current_action('create')) {
        return false;
    }
    if (!is_user_logged_in() || !bp_blog_signup_enabled()) {
        return false;
    }
    do_action('bp_blogs_screen_create_a_blog');
    bp_core_load_template(apply_filters('bp_blogs_template_create_a_blog', 'blogs/create'));
}
开发者ID:eresyyl,项目名称:mk,代码行数:14,代码来源:bp-blogs-screens.php


示例14: messages_add_autocomplete_css

function messages_add_autocomplete_css()
{
    global $bp;
    if (bp_is_messages_component() && bp_is_current_action('compose')) {
        if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
            nxt_enqueue_style('bp-messages-autocomplete', BP_PLUGIN_URL . '/bp-messages/css/autocomplete/jquery.autocompletefb.dev.css', array(), '20110723');
        } else {
            nxt_enqueue_style('bp-messages-autocomplete', BP_PLUGIN_URL . '/bp-messages/css/autocomplete/jquery.autocompletefb.css', array(), '20110723');
        }
        nxt_print_styles();
    }
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:12,代码来源:bp-messages-cssjs.php


示例15: bp_portfolio_screen_edit

/**
 * Sets up and displays the screen output for the sub nav item "portfolio/edit/%d"
 */
function bp_portfolio_screen_edit()
{
    if (bp_is_portfolio_component() and bp_is_current_action('edit') and bp_displayed_user_id() == bp_loggedin_user_id()) {
        if (isset($_POST['edit'])) {
            // Check to see if the project belong to the logged_in user
            global $project;
            $project_id = bp_action_variable();
            $project = new BP_Portfolio_Item();
            $project->get(array('id' => $project_id));
            if ($project->query->post->post_author != bp_loggedin_user_id()) {
                bp_core_add_message(__('There was an error recording the project, please try again', 'bp-portfolio'), 'error');
                bp_core_load_template(apply_filters('bp_portfolio_template_screen_add', BP_PORTFOLIO_TEMPLATE . '/personal'));
            }
            // Check the nonce
            if (!wp_verify_nonce($_POST['_wpnonce'], 'project_form_nonce')) {
                bp_core_add_message(__('There was an error recording the project, please try again', 'bp-portfolio'), 'error');
                bp_core_load_template(apply_filters('bp_portfolio_template_screen_add', BP_PORTFOLIO_TEMPLATE . '/personal'));
            }
            if (empty($_POST['title-input']) or empty($_POST['url-input']) or empty($_POST['description'])) {
                bp_core_add_message(__('All fields are required', 'bp-portfolio'), 'error');
                $project_id = bp_action_variable();
                global $project;
                $project = new BP_Portfolio_Item();
                $project->get(array('id' => $project_id));
            } else {
                // Edit the post
                $posts = array('id' => bp_action_variable(), 'author_id' => bp_loggedin_user_id(), 'title' => $_POST['title-input'], 'description' => $_POST['description'], 'url' => $_POST['url-input']);
                // Is that a capture has been sent ?
                if (isset($_FILES['screenshot-input']) and $_FILES['screenshot-input']['error'] == 0) {
                    $posts['screenshot'] = $_FILES['screenshot-input'];
                }
                if ($item = bp_portfolio_save_item($posts)) {
                    bp_core_add_message(__('Project has been edited', 'bp-portfolio'));
                    bp_core_redirect(bp_core_get_user_domain(bp_loggedin_user_id()) . bp_get_portfolio_slug());
                } else {
                    bp_core_add_message(__('There was an error recording the item, please try again', 'bp-portfolio'), 'error');
                }
            }
        } else {
            // Create a global $project, so template will know that this is the edit page
            if ($project_id = bp_action_variable()) {
                global $project;
                $project_id = bp_action_variable();
                $project = new BP_Portfolio_Item();
                $project->get(array('id' => $project_id));
                if ($project->query->post->post_author == bp_loggedin_user_id()) {
                    bp_core_load_template(apply_filters('bp_portfolio_template_screen_one', BP_PORTFOLIO_TEMPLATE . '/add'));
                }
            }
        }
    }
}
开发者ID:ncrocfer,项目名称:BP-Portfolio,代码行数:55,代码来源:bp-portfolio-screens.php


示例16: messages_add_autocomplete_css

/**
 * Enqueue the CSS for messages autocomplete.
 *
 * @todo Why do we call wp_print_styles()?
 */
function messages_add_autocomplete_css()
{
    if (bp_is_messages_component() && bp_is_current_action('compose')) {
        $min = bp_core_get_minified_asset_suffix();
        $url = buddypress()->plugin_url . 'bp-messages/css/';
        wp_enqueue_style('bp-messages-autocomplete', "{$url}autocomplete/jquery.autocompletefb{$min}.css", array(), bp_get_version());
        wp_style_add_data('bp-messages-autocomplete', 'rtl', true);
        if ($min) {
            wp_style_add_data('bp-messages-autocomplete', 'suffix', $min);
        }
        wp_print_styles();
    }
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:18,代码来源:bp-messages-cssjs.php


示例17: bp_portfolio_item_delete

/**
 * Delte an item 
 */
function bp_portfolio_item_delete()
{
    if (bp_is_portfolio_component() and bp_is_current_action('delete') and bp_displayed_user_id() == bp_loggedin_user_id()) {
        if ($project_id = bp_action_variable() and wp_verify_nonce($_REQUEST['_wpnonce'], 'delete_project')) {
            if (bp_portfolio_delete_item($project_id)) {
                bp_core_add_message(__('Project deleted !', 'bp-portfolio'));
            } else {
                bp_core_add_message(__('An error occured, please try again.', 'bp-portfolio'), 'error');
            }
        } else {
            bp_core_add_message(__('An error occured, please try again.', 'bp-portfolio'), 'error');
        }
        bp_core_redirect(bp_core_get_user_domain(bp_loggedin_user_id()) . bp_get_portfolio_slug());
    }
}
开发者ID:ncrocfer,项目名称:BP-Portfolio,代码行数:18,代码来源:bp-portfolio-actions.php


示例18: thatcamp_new_group_rss_catcher

function thatcamp_new_group_rss_catcher()
{
    global $wp_query;
    $feed_template = false;
    if (bp_is_groups_component() && bp_is_current_action('feed')) {
        $feed_template = 'rss-newest-groups.php';
    }
    if (!$feed_template) {
        return;
    }
    $wp_query->is_404 = false;
    status_header(200);
    include __DIR__ . '/includes/' . $feed_template;
    die;
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:15,代码来源:thatcamp-new-groups-feed.php


示例19: bp_blogs_screen_create_a_blog

/**
 * Load the "Create a Blog" screen.
 */
function bp_blogs_screen_create_a_blog()
{
    if (!is_multisite() || !bp_is_blogs_component() || !bp_is_current_action('create')) {
        return false;
    }
    if (!is_user_logged_in() || !bp_blog_signup_enabled()) {
        return false;
    }
    /**
     * Fires right before the loading of the Create A Blog screen template file.
     *
     * @since 1.0.0
     */
    do_action('bp_blogs_screen_create_a_blog');
    bp_core_load_template(apply_filters('bp_blogs_template_create_a_blog', 'blogs/create'));
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:19,代码来源:bp-blogs-screens.php


示例20: messages_screen_conversation

function messages_screen_conversation()
{
    // Bail if not viewing a single message
    if (!bp_is_messages_component() || !bp_is_current_action('view')) {
        return false;
    }
    $thread_id = (int) bp_action_variable(0);
    if (empty($thread_id) || !messages_is_valid_thread($thread_id) || !messages_check_thread_access($thread_id) && !bp_current_user_can('bp_moderate')) {
        bp_core_redirect(trailingslashit(bp_displayed_user_domain() . bp_get_messages_slug()));
    }
    // Load up BuddyPress one time
    $bp = buddypress();
    // Decrease the unread count in the nav before it's rendered
    $bp->bp_nav[$bp->messages->slug]['name'] = sprintf(__('Messages <span>%s</span>', 'buddypress'), bp_get_total_unread_messages_count());
    do_action('messages_screen_conversation');
    bp_core_load_template(apply_filters('messages_template_view_message', 'members/single/home'));
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:17,代码来源:bp-messages-screens.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP bp_is_current_component函数代码示例发布时间:2022-05-24
下一篇:
PHP bp_is_create_blog函数代码示例发布时间: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