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


PHP bp_action_variables函数代码示例

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


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

示例1: bp_forums_directory_forums_setup

function bp_forums_directory_forums_setup()
{
    global $bp;
    if (bp_is_forums_component() && (!bp_current_action() || 'tag' == bp_current_action() && bp_action_variables()) && !bp_current_item()) {
        if (!bp_forums_has_directory()) {
            return false;
        }
        if (!bp_forums_is_installed_correctly()) {
            bp_core_add_message(__('The forums component has not been set up yet.', 'buddypress'), 'error');
            bp_core_redirect(bp_get_root_domain());
        }
        bp_update_is_directory(true, 'forums');
        do_action('bbpress_init');
        // Check to see if the user has posted a new topic from the forums page.
        if (isset($_POST['submit_topic']) && bp_is_active('forums')) {
            check_admin_referer('bp_forums_new_topic');
            $bp->groups->current_group = groups_get_group(array('group_id' => $_POST['topic_group_id']));
            if (!empty($bp->groups->current_group->id)) {
                // Auto join this user if they are not yet a member of this group
                if (!is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member($bp->loggedin_user->id, $bp->groups->current_group->id)) {
                    groups_join_group($bp->groups->current_group->id);
                }
                $error_message = '';
                $forum_id = groups_get_groupmeta($bp->groups->current_group->id, 'forum_id');
                if (!empty($forum_id)) {
                    if (empty($_POST['topic_title'])) {
                        $error_message = __('Please provide a title for your forum topic.', 'buddypress');
                    } else {
                        if (empty($_POST['topic_text'])) {
                            $error_message = __('Forum posts cannot be empty. Please enter some text.', 'buddypress');
                        }
                    }
                    if ($error_message) {
                        bp_core_add_message($error_message, 'error');
                        $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum';
                    } else {
                        if (!($topic = groups_new_group_forum_topic($_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id))) {
                            bp_core_add_message(__('There was an error when creating the topic', 'buddypress'), 'error');
                            $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum';
                        } else {
                            bp_core_add_message(__('The topic was created successfully', 'buddypress'));
                            $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum/topic/' . $topic->topic_slug . '/';
                        }
                    }
                    bp_core_redirect($redirect);
                } else {
                    bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error');
                    bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink()));
                }
            } else {
                bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error');
                bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink()));
            }
        }
        do_action('bp_forums_directory_forums_setup');
        bp_core_load_template(apply_filters('bp_forums_template_directory_forums_setup', 'forums/index'));
    }
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:58,代码来源:bp-forums-screens.php

示例2: bp_settings_screen_capabilities

/**
 * Show the capabilities settings template
 *
 * @since BuddyPress (1.6)
 *
 * @return If we shouldn't be here
 */
function bp_settings_screen_capabilities()
{
    if (bp_action_variables()) {
        bp_do_404();
        return;
    }
    // Load the template
    bp_core_load_template(apply_filters('bp_settings_screen_capabilities', 'members/single/settings/capabilities'));
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:16,代码来源:bp-settings-screens.php

示例3: bp_xprofile_action_settings

/**
 * Handles the saving of xprofile field visibilities
 *
 * @since BuddyPress (1.9)
 */
function bp_xprofile_action_settings()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    // Bail if no submit action
    if (!isset($_POST['xprofile-settings-submit'])) {
        return;
    }
    // Bail if not in settings
    if (!bp_is_user_settings_profile()) {
        return;
    }
    // 404 if there are any additional action variables attached
    if (bp_action_variables()) {
        bp_do_404();
        return;
    }
    // Nonce check
    check_admin_referer('bp_xprofile_settings');
    do_action('bp_xprofile_settings_before_save');
    /** Save ******************************************************************/
    // Only save if there are field ID's being posted
    if (!empty($_POST['field_ids'])) {
        // Get the POST'ed field ID's
        $posted_field_ids = explode(',', $_POST['field_ids']);
        // Backward compatibility: a bug in BP 2.0 caused only a single
        // group's field IDs to be submitted. Look for values submitted
        // in the POST request that may not appear in 'field_ids', and
        // add them to the list of IDs to save.
        foreach ($_POST as $posted_key => $posted_value) {
            preg_match('/^field_([0-9]+)_visibility$/', $posted_key, $matches);
            if (!empty($matches[1]) && !in_array($matches[1], $posted_field_ids)) {
                $posted_field_ids[] = $matches[1];
            }
        }
        // Save the visibility settings
        foreach ($posted_field_ids as $field_id) {
            $visibility_level = 'public';
            if (!empty($_POST['field_' . $field_id . '_visibility'])) {
                $visibility_level = $_POST['field_' . $field_id . '_visibility'];
            }
            xprofile_set_field_visibility_level($field_id, bp_displayed_user_id(), $visibility_level);
        }
    }
    /** Other *****************************************************************/
    do_action('bp_xprofile_settings_after_save');
    // Redirect to the root domain
    bp_core_redirect(bp_displayed_user_domain() . bp_get_settings_slug() . '/profile');
}
开发者ID:eresyyl,项目名称:mk,代码行数:56,代码来源:bp-xprofile-actions.php

示例4: setup_globals

 /**
  * Stores some handy information in the $bp global
  *
  * @package BuddyPress Docs
  * @since 1.0-beta
  */
 function setup_globals()
 {
     global $bp;
     $bp->bp_docs->format_notification_function = 'bp_docs_format_notifications';
     $bp->bp_docs->slug = BP_DOCS_SLUG;
     // This info is loaded here because it needs to happen after BP core globals are
     // set up
     $this->slugstocheck = bp_action_variables() ? bp_action_variables() : array();
     $this->slugstocheck[] = bp_current_component();
     $this->slugstocheck[] = bp_current_action();
     // Todo: You only need this if you need top level access: example.com/docs
     /* Register this in the active components array */
     //$bp->active_components[ $bp->wiki->slug ] = $bp->wiki->id;
 }
开发者ID:Nightgunner5,项目名称:Pubcomp-CMS,代码行数:20,代码来源:integration-bp.php

示例5: breadcrumb_bp_current_item

function breadcrumb_bp_current_item($item)
{
    $params = array('bp_component' => bp_current_component(), 'bp_item' => bp_current_item(), 'bp_action' => bp_current_action(), 'bp_action_variables' => bp_action_variables());
    switch (bp_current_component()) {
        case false:
            return $item;
            break;
        case 'groups':
            return new Breadcrumb_BP_Component_Group($item, $params);
            break;
        default:
            return new Breadcrumb_BP_Component($item, $params);
    }
}
开发者ID:kubens,项目名称:Snippets,代码行数:14,代码来源:bp.php

示例6: bp_settings_screen_capabilities

/**
 * Show the capabilities settings template
 *
 * @since BuddyPress (1.6.0)
 */
function bp_settings_screen_capabilities()
{
    if (bp_action_variables()) {
        bp_do_404();
        return;
    }
    /**
     * Filters the template file path to use for the capabilities settings screen.
     *
     * @since BuddyPress (1.6.0)
     *
     * @param string $value Directory path to look in for the template file.
     */
    bp_core_load_template(apply_filters('bp_settings_screen_capabilities', 'members/single/settings/capabilities'));
}
开发者ID:un1coin,项目名称:ovn-space,代码行数:20,代码来源:bp-settings-screens.php

示例7: bp_portfolio_screen_add

/**
 * Sets up and displays the screen output for the sub nav item "portfolio/add"
 */
function bp_portfolio_screen_add()
{
    global $bp;
    if (bp_action_variables()) {
        bp_do_404();
        return;
    }
    messages_remove_callback_values();
    if (isset($_POST['add'])) {
        // 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_personal', 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');
        } else {
            // Check the url
            if (!preg_match("/(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?/", $_POST['url-input'])) {
                bp_core_add_message(__('Url must be a valid URL.', 'bp-portfolio'), 'error');
                bp_core_load_template(apply_filters('bp_portfolio_template_add', BP_PORTFOLIO_TEMPLATE . '/add'));
            }
            // Check description size
            if (strlen($_POST['description']) > BP_PORTFOLIO_DESC_MAX_SIZE) {
                $_POST['description'] = substr($_POST['description'], 0, BP_PORTFOLIO_DESC_MAX_SIZE);
            }
            // Save the item
            $posts = array('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 saved', '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 project, please try again', 'bp-portfolio'), 'error');
            }
        }
    }
    do_action('bp_portfolio_add_screen');
    // Displaying Content
    bp_core_load_template(apply_filters('bp_portfolio_template_add', BP_PORTFOLIO_TEMPLATE . '/add'));
}
开发者ID:ncrocfer,项目名称:BP-Portfolio,代码行数:47,代码来源:bp-portfolio-screens.php

示例8: bp_xprofile_action_settings

/**
 * Handles the saving of xprofile field visibilities
 *
 * @since BuddyPress (1.9)
 */
function bp_xprofile_action_settings()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    // Bail if no submit action
    if (!isset($_POST['xprofile-settings-submit'])) {
        return;
    }
    // Bail if not in settings
    if (!bp_is_user_settings_profile()) {
        return;
    }
    // 404 if there are any additional action variables attached
    if (bp_action_variables()) {
        bp_do_404();
        return;
    }
    // Nonce check
    check_admin_referer('bp_xprofile_settings');
    do_action('bp_xprofile_settings_before_save');
    /** Save ******************************************************************/
    // Only save if there are field ID's being posted
    if (!empty($_POST['field_ids'])) {
        // Get the POST'ed field ID's
        $posted_field_ids = explode(',', $_POST['field_ids']);
        // Save the visibility settings
        foreach ($posted_field_ids as $field_id) {
            $visibility_level = 'public';
            if (!empty($_POST['field_' . $field_id . '_visibility'])) {
                $visibility_level = $_POST['field_' . $field_id . '_visibility'];
            }
            xprofile_set_field_visibility_level($field_id, bp_displayed_user_id(), $visibility_level);
        }
    }
    /** Other *****************************************************************/
    do_action('bp_xprofile_settings_after_save');
    // Redirect to the root domain
    bp_core_redirect(bp_displayed_user_domain() . bp_get_settings_slug() . '/profile');
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:46,代码来源:bp-xprofile-actions.php

示例9: bebop_manage_provider

function bebop_manage_provider()
{
    global $bp;
    if (bp_is_current_component('bebop') && bp_is_current_action('bebop-accounts')) {
        $query_string = bp_action_variables();
        if (!empty($query_string)) {
            $provider = $query_string[0];
        }
        if (!empty($provider)) {
            global $bp;
            $extension = bebop_extensions::bebop_get_extension_config_by_name(strtolower($provider));
            if (isset($_POST['submit'])) {
                check_admin_referer('bebop_' . $extension['name'] . '_user_settings');
                if (isset($_POST['bebop_' . $extension['name'] . '_active_for_user'])) {
                    bebop_tables::update_user_meta($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_active_for_user', $_POST['bebop_' . $extension['name'] . '_active_for_user']);
                    bp_core_add_message(sprintf(__('Settings for %1$s have been saved.', 'bebop'), $extension['display_name']));
                }
                if (!empty($_POST['bebop_' . $extension['name'] . '_username'])) {
                    $new_name = stripslashes($_POST['bebop_' . $extension['name'] . '_username']);
                    if (bebop_tables::add_user_meta($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_username', $new_name, $check_meta_value = true)) {
                        bebop_tables::add_to_first_importers_list($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_' . $new_name . '_do_initial_import', $new_name);
                        bp_core_add_message(sprintf(__('%1$s has been added to the %2$s feed.', 'bebop'), $new_name, $extension['display_name']));
                    } else {
                        bp_core_add_message(sprintf(__('%1$s already exists in the %2$s feed; you cannot add it again.', 'bebop'), $new_name, $extension['display_name']), __('error', 'bebop'));
                    }
                }
                //Try and add a new RSS feed.
                if (!empty($_POST['bebop_' . $extension['name'] . '_newfeedname']) && !empty($_POST['bebop_' . $extension['name'] . '_newfeedurl'])) {
                    if (filter_var($_POST['bebop_' . $extension['name'] . '_newfeedurl'], FILTER_VALIDATE_URL)) {
                        $insert_url = $_POST['bebop_' . $extension['name'] . '_newfeedurl'];
                        $new_name = str_replace(' ', '_', stripslashes(strip_tags($_POST['bebop_' . $extension['name'] . '_newfeedname'])));
                        if (bebop_tables::add_user_meta($bp->loggedin_user->id, $extension['name'] . '_' . $new_name, $new_name, strip_tags($insert_url))) {
                            bebop_tables::add_to_first_importers_list($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_' . $new_name . '_do_initial_import', $new_name);
                            bp_core_add_message(__('Feed successfully added.', 'bebop'));
                        } else {
                            bp_core_add_message(__('This feed already exists, you cannot add it again.', 'bebop'), __('error', 'bebop'));
                        }
                    } else {
                        bp_core_add_message(__('That feed cannot be added as it is not a valid URL.', 'bebop'), __('error', 'bebop'));
                    }
                }
                //
                //Extension authors: use this hook to add your own data saves.
                do_action('bebop_user_settings_pre_edit_save', $extension);
                bp_core_redirect($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action());
            }
            //End if ( isset( $_POST['submit'] ) ) {
            //Twitter Oauth stuff
            if (isset($_GET['oauth_token'])) {
                //Handle the oAuth requests
                $OAuth = new bebop_oauth();
                $OAuth->set_request_token_url($extension['request_token_url']);
                $OAuth->set_access_token_url($extension['access_token_url']);
                $OAuth->set_authorize_url($extension['authorize_url']);
                $OAuth->set_parameters(array('oauth_verifier' => $_GET['oauth_verifier']));
                $OAuth->set_callback_url($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action() . '/' . $extension['name']);
                $OAuth->set_consumer_key(bebop_tables::get_option_value('bebop_' . $extension['name'] . '_consumer_key'));
                $OAuth->set_consumer_secret(bebop_tables::get_option_value('bebop_' . $extension['name'] . '_consumer_secret'));
                $OAuth->set_request_token(bebop_tables::get_user_meta_value($bp->loggedin_user->id, 'bebop_' . $extension['name'] . '_oauth_token_temp'));
                $OAuth->set_request_token_secret(bebop_tables::get_user_meta_value($bp->loggedin_user->id, 'bebop_' . $extension['name'] . '_oauth_token_secret_temp'));
                $accessToken = $OAuth->access_token();
                bebop_tables::update_user_meta($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_oauth_token', $accessToken['oauth_token']);
                bebop_tables::update_user_meta($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_oauth_token_secret', $accessToken['oauth_token_secret']);
                bebop_tables::update_user_meta($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_active_for_user', 1);
                bebop_tables::add_to_first_importers_list($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_do_initial_import', 1);
                bp_core_add_message(sprintf(__('You have successfully authenticated your %1$s account.', 'bebop'), $extension['display_name']));
                bp_core_redirect($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action());
            }
            //Facebook oAuth stuff.
            if (isset($_REQUEST['code'])) {
                $app_id = bebop_tables::get_option_value('bebop_' . $extension['name'] . '_consumer_key');
                $app_secret = bebop_tables::get_option_value('bebop_' . $extension['name'] . '_consumer_secret');
                $my_url = urlencode($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action() . '/' . $extension['name'] . '?scope=read_stream');
                if ($_SESSION['facebook_state'] == $_GET['state']) {
                    $code = $_GET['code'];
                    $accessTokenUrl = str_replace('APP_ID', $app_id, $extension['access_token_url']);
                    $accessTokenUrl = str_replace('REDIRECT_URI', $my_url, $accessTokenUrl);
                    $accessTokenUrl = str_replace('APP_SECRET', $app_secret, $accessTokenUrl);
                    $accessTokenUrl = str_replace('CODE', $code, $accessTokenUrl);
                    $response = file_get_contents($accessTokenUrl);
                    parse_str($response, $params);
                    //extend access token
                    $extendedAccessTokenUrl = str_replace('APP_ID', $app_id, $extension['extend_access_token_url']);
                    $extendedAccessTokenUrl = str_replace('APP_SECRET', $app_secret, $extendedAccessTokenUrl);
                    $extendedAccessTokenUrl = str_replace('SHORT_TOKEN', $params['access_token'], $extendedAccessTokenUrl);
                    $response2 = file_get_contents($extendedAccessTokenUrl);
                    parse_str($response2, $params2);
                    //save the extended access token
                    if (isset($params['access_token'])) {
                        bebop_tables::update_user_meta($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_oauth_token', $params2['access_token']);
                        bebop_tables::update_user_meta($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_active_for_user', 1);
                        bebop_tables::add_to_first_importers_list($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_do_initial_import', 1);
                        bp_core_add_message(sprintf(__('You have successfully authenticated your %1$s account.', 'bebop'), $extension['display_name']));
                        bp_core_redirect($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action());
                        unset($_SESSION['facebook_state']);
                    }
                }
            }
            //delete a user's feed
            if (isset($_GET['delete_feed'])) {
//.........这里部分代码省略.........
开发者ID:adisonc,项目名称:MaineLearning,代码行数:101,代码来源:bebop-core.php

示例10: setup_globals

 /**
  * Implementation of BP_Component::setup_globals()
  *
  * Creates globals required by BP_Component.
  * Registers post_type and taxonomy names in component global.
  * Sets up the 'slugstocheck', which are used when enqueuing styles and scripts.
  *
  * @since 1.2
  * @see BP_Docs_Component::enqueue_scripts()
  * @see BP_Docs_Component::enqueue_styles()
  */
 function setup_globals($args = array())
 {
     global $bp_docs;
     // Set up the $globals array to be passed along to parent::setup_globals()
     $globals = array('slug' => bp_docs_get_docs_slug(), 'root_slug' => isset($bp->pages->{$this->id}->slug) ? $bp->pages->{$this->id}->slug : bp_docs_get_docs_slug(), 'has_directory' => false, 'notification_callback' => 'bp_docs_format_notifications', 'search_string' => __('Search Docs...', 'buddypress'));
     // Let BP_Component::setup_globals() do its work.
     parent::setup_globals($globals);
     // Stash tax and post type names in the $bp global for use in template tags
     $this->post_type_name = $bp_docs->post_type_name;
     $this->associated_item_tax_name = $bp_docs->associated_item_tax_name;
     $this->access_tax_name = $bp_docs->access_tax_name;
     // This info is loaded here because it needs to happen after BP core globals are
     // set up
     $this->slugstocheck = bp_action_variables() ? bp_action_variables() : array();
     $this->slugstocheck[] = bp_current_component();
     $this->slugstocheck[] = bp_current_action();
     $this->set_current_item_type();
     $this->set_current_view();
 }
开发者ID:pausaura,项目名称:agora_nodes,代码行数:30,代码来源:component.php

示例11: bp_xprofile_screen_settings

/**
 * Show the xprofile settings template
 *
 * @since BuddyPress (2.0.0)
 */
function bp_xprofile_screen_settings()
{
    // Redirect if no privacy settings page is accessible
    if (bp_action_variables() || !bp_is_active('xprofile')) {
        bp_do_404();
        return;
    }
    /**
     * Filters the template to load for the XProfile settings screen.
     *
     * @since BuddyPress (2.0.0)
     *
     * @param string $template Path to the XProfile change avatar template to load.
     */
    bp_core_load_template(apply_filters('bp_settings_screen_xprofile', '/members/single/settings/profile'));
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:21,代码来源:bp-xprofile-screens.php

示例12: setup_canonical_stack

 /**
  * Set up canonical stack for this component.
  *
  * @since BuddyPress (2.1.0)
  */
 public function setup_canonical_stack()
 {
     $bp = buddypress();
     /** Default Profile Component *****************************************/
     if (defined('BP_DEFAULT_COMPONENT') && BP_DEFAULT_COMPONENT) {
         $bp->default_component = BP_DEFAULT_COMPONENT;
     } else {
         if (bp_is_active('activity') && isset($bp->pages->activity)) {
             $bp->default_component = bp_get_activity_slug();
         } else {
             $bp->default_component = 'xprofile' === $bp->profile->id ? 'profile' : $bp->profile->id;
         }
     }
     /** Canonical Component Stack *****************************************/
     if (bp_displayed_user_id()) {
         $bp->canonical_stack['base_url'] = bp_displayed_user_domain();
         if (bp_current_component()) {
             $bp->canonical_stack['component'] = bp_current_component();
         }
         if (bp_current_action()) {
             $bp->canonical_stack['action'] = bp_current_action();
         }
         if (!empty($bp->action_variables)) {
             $bp->canonical_stack['action_variables'] = bp_action_variables();
         }
         // Looking at the single member root/home, so assume the default
         if (!bp_current_component()) {
             $bp->current_component = $bp->default_component;
             // The canonical URL will not contain the default component
         } elseif (bp_is_current_component($bp->default_component) && !bp_current_action()) {
             unset($bp->canonical_stack['component']);
         }
         // if we're on a spammer's profile page, only users with the 'bp_moderate' cap
         // can view subpages on the spammer's profile
         //
         // users without the cap trying to access a spammer's subnav page will get
         // redirected to the root of the spammer's profile page.  this occurs by
         // by removing the component in the canonical stack.
         if (bp_is_user_spammer(bp_displayed_user_id()) && !bp_current_user_can('bp_moderate')) {
             unset($bp->canonical_stack['component']);
         }
     }
 }
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:48,代码来源:bp-members-loader.php

示例13: xprofile_screen_change_avatar

/**
 * Handles the uploading and cropping of a user avatar. Displays the change avatar page.
 *
 * @package BuddyPress XProfile
 * @uses bp_is_my_profile() Checks to make sure the current user being viewed equals the logged in user
 * @uses bp_core_load_template() Looks for and loads a template file within the current member theme (folder/filename)
 */
function xprofile_screen_change_avatar()
{
    global $bp;
    if (!bp_is_my_profile() && !is_super_admin()) {
        return false;
    }
    if (bp_action_variables()) {
        bp_do_404();
        return;
    }
    $bp->avatar_admin->step = 'upload-image';
    if (!empty($_FILES)) {
        // Check the nonce
        check_admin_referer('bp_avatar_upload');
        // Pass the file to the avatar upload handler
        if (bp_core_avatar_handle_upload($_FILES, 'xprofile_avatar_upload_dir')) {
            $bp->avatar_admin->step = 'crop-image';
            // Make sure we include the jQuery jCrop file for image cropping
            add_action('nxt_print_scripts', 'bp_core_add_jquery_cropper');
        }
    }
    // If the image cropping is done, crop the image and save a full/thumb version
    if (isset($_POST['avatar-crop-submit'])) {
        // Check the nonce
        check_admin_referer('bp_avatar_cropstore');
        if (!bp_core_avatar_handle_crop(array('item_id' => $bp->displayed_user->id, 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h']))) {
            bp_core_add_message(__('There was a problem cropping your avatar, please try uploading it again', 'buddypress'), 'error');
        } else {
            bp_core_add_message(__('Your new avatar was uploaded successfully!', 'buddypress'));
            do_action('xprofile_avatar_uploaded');
        }
    }
    do_action('xprofile_screen_change_avatar');
    bp_core_load_template(apply_filters('xprofile_template_change_avatar', 'members/single/home'));
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:42,代码来源:bp-xprofile-screens.php

示例14: bp_xprofile_screen_settings

/**
 * Show the xprofile settings template
 *
 * @since BuddyPress (2.0.0)
 */
function bp_xprofile_screen_settings()
{
    // Redirect if no privacy settings page is accessible
    if (bp_action_variables() || !bp_is_active('xprofile')) {
        bp_do_404();
        return;
    }
    // Load the template
    bp_core_load_template(apply_filters('bp_settings_screen_xprofile', '/members/single/settings/profile'));
}
开发者ID:eresyyl,项目名称:mk,代码行数:15,代码来源:bp-xprofile-screens.php

示例15: bp_action_variables

/*
 * IMPORTANT - PLEASE READ **************************************************************************
 * All the mechanics to control this plugin are automatically generated from the extension name.	*
 * You do not need to modify this page, unless you wish to add additional customisable parameters	*
 * for the extension. Removing/changing any of the pre defined functions will cause import errors,	*
 * and possible other unexpected or unwanted behaviour.												*
 * For information on bebop_tables:: functions, please see bebop/core/bebop-tables.php				*
 * **************************************************************************************************
 */
global $bp;
/*
 * '$extension' controls content on this page and is set to whatever admin-settings.php file is being viewed.
 * i.e. if you extension name is 'my_extension', the value of $extension will be 'my_extension'.
 * The extension has to exist if this page is being included.
 */
$query_string = bp_action_variables();
if (!empty($query_string)) {
    $provider = $query_string[0];
}
$extension = bebop_extensions::bebop_get_extension_config_by_name(strtolower($provider));
//put some options into variables
$active = 'bebop_' . $extension['name'] . '_active_for_user';
//the active boolean name
${$active} = bebop_tables::get_user_meta_value($bp->loggedin_user->id, 'bebop_' . $extension['name'] . '_active_for_user');
//the value of the boolean
if (bebop_tables::get_option_value('bebop_' . $extension['name'] . '_provider') == 'on') {
    echo '<h5>' . sprintf(__('%1$s Settings', 'bebop'), $extension['display_name']) . '</h5>
	<p>' . sprintf(__('Generic settings for %1$s. Here you can select whether content is actively imported into WordPress.', 'bebop'), $extension['display_name']) . '</p>';
    echo '<form id="settings_form" action="' . $bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action() . '/' . $extension['name'] . '" method="post">';
    echo '<label>' . sprintf(__('Enable %1$s import', 'bebop'), $extension['display_name']) . ':</label>
	<input type="radio" name="bebop_' . $extension['name'] . '_active_for_user" id="bebop_' . $extension['name'] . '_active_for_user" value="1"';
开发者ID:adisonc,项目名称:MaineLearning,代码行数:31,代码来源:user-settings.php


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