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


PHP bp_core_redirect函数代码示例

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


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

示例1: friends_screen_requests

/**
 * Catch and process the Requests page.
 */
function friends_screen_requests()
{
    if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_accept_friendship');
        if (friends_accept_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship accepted', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_reject_friendship');
        if (friends_reject_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship rejected', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('cancel', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_withdraw_friendship');
        if (friends_withdraw_friendship(bp_loggedin_user_id(), bp_action_variable(1))) {
            bp_core_add_message(__('Friendship request withdrawn', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship request could not be withdrawn', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    }
    do_action('friends_screen_requests');
    bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
开发者ID:eresyyl,项目名称:mk,代码行数:36,代码来源:bp-friends-screens.php

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

示例3: friends_screen_requests

function friends_screen_requests()
{
    if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_accept_friendship');
        if (friends_accept_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship accepted', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
        }
        bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
    } elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_reject_friendship');
        if (friends_reject_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship rejected', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
        }
        bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
    }
    do_action('friends_screen_requests');
    if (isset($_GET['new'])) {
        bp_core_delete_notifications_by_type(bp_loggedin_user_id(), 'friends', 'friendship_request');
    }
    bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
开发者ID:hornetalcala,项目名称:trunk,代码行数:27,代码来源:bp-friends-screens.php

示例4: bp_blogs_redirect_to_random_blog

function bp_blogs_redirect_to_random_blog()
{
    global $bp, $nxtdb;
    if (bp_is_blogs_component() && isset($_GET['random-blog'])) {
        $blog = bp_blogs_get_random_blogs(1, 1);
        bp_core_redirect(get_site_url($blog['blogs'][0]->blog_id));
    }
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:8,代码来源:bp-blogs-actions.php

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

示例6: bphelp_pbpp_redirect

function bphelp_pbpp_redirect()
{
    global $bp;
    //IMPORTANT: Do not alter the following line.
    $bphelp_my_redirect_slug = get_option('bphelp-my-redirect-slug', 'register');
    if (bp_is_activity_component() || bp_is_groups_component() || bp_is_group_forum() || bbp_is_single_forum() || bbp_is_single_topic() || bp_is_forums_component() || bp_is_blogs_component() || bp_is_members_component() || bp_is_profile_component()) {
        if (!is_user_logged_in()) {
            bp_core_redirect(get_option('home') . '/' . $bphelp_my_redirect_slug);
        }
    }
}
开发者ID:pausaura,项目名称:agora_nodes,代码行数:11,代码来源:private-bp-pages.php

示例7: reject_this_page_view

/**
* Reject the curren page view. It currently only supports re-direction.
* But should perhaps support to just hide content and show a message or something?
*/
function reject_this_page_view()
{
    global $post;
    $redirect_page_id = get_option('wc_memberships_redirect_page_id');
    if ($post->ID == $redirect_page_id) {
        return;
    }
    $redirect_url = $redirect_page_id ? get_permalink($redirect_page_id) : home_url();
    bp_core_redirect($redirect_url);
    exit;
}
开发者ID:kumpul,项目名称:wordpress-the7-child-theme,代码行数:15,代码来源:functions.php

示例8: bp_blogs_redirect_to_random_blog

/**
 * Redirect to a random blog in the multisite network
 *
 * @since BuddyPress (1.0)
 * @package BuddyPress
 * @subpackage BlogsActions
 */
function bp_blogs_redirect_to_random_blog()
{
    // Bail if not looking for a random blog
    if (!bp_is_blogs_component() || !isset($_GET['random-blog'])) {
        return;
    }
    // Multisite is active so find a random blog
    if (is_multisite()) {
        $blog = bp_blogs_get_random_blogs(1, 1);
        bp_core_redirect(get_site_url($blog['blogs'][0]->blog_id));
        // No multisite and still called, always redirect to root
    } else {
        bp_core_redirect(bp_core_get_root_domain());
    }
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:22,代码来源:bp-blogs-actions.php

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

示例10: edit_screen_save

 public function edit_screen_save($group_id = null)
 {
     $bp = buddypress();
     if (!isset($_POST['save'])) {
         return false;
     }
     check_admin_referer('groups_edit_save_' . $this->slug);
     $group_id = $bp->groups->current_group->id;
     $cats = $_POST['blog_cats'];
     if (!bcg_update_categories($group_id, $cats)) {
         bp_core_add_message(__('There was an error updating Group Blog Categories settings, please try again.', 'bcg'), 'error');
     } else {
         bp_core_add_message(__('Group Blog Categories settings were successfully updated.', 'bcg'));
     }
     bp_core_redirect(bp_get_group_permalink($bp->groups->current_group) . '/admin/' . $this->slug);
 }
开发者ID:WP--plugins,项目名称:blog-categories-for-groups,代码行数:16,代码来源:bcg-admin.php

示例11: bp_example_high_five_save

/**
 * Check to see if a high five is being given, and if so, save it.
 *
 * Hooked to bp_actions, this function will fire before the screen function. We use our function
 * bp_is_example_component(), along with the bp_is_current_action() and bp_is_action_variable()
 * functions, to detect (based on the requested URL) whether the user has clicked on "send high
 * five". If so, we do a bit of simple logic to see what should happen next.
 *
 * @package BuddyPress_Skeleton_Component
 * @since 1.6
 */
function bp_example_high_five_save()
{
    if (bp_is_example_component() && bp_is_current_action('screen-one') && bp_is_action_variable('send-h5', 0)) {
        // The logged in user has clicked on the 'send high five' link
        if (bp_is_my_profile()) {
            // Don't let users high five themselves
            bp_core_add_message(__('No self-fives! :)', 'bp-example'), 'error');
        } else {
            if (bp_example_send_highfive(bp_displayed_user_id(), bp_loggedin_user_id())) {
                bp_core_add_message(__('High-five sent!', 'bp-example'));
            } else {
                bp_core_add_message(__('High-five could not be sent.', 'bp-example'), 'error');
            }
        }
        bp_core_redirect(bp_displayed_user_domain() . bp_get_example_slug() . '/screen-one');
    }
}
开发者ID:natrio,项目名称:buddypress-skeleton-component,代码行数:28,代码来源:bp-example-actions.php

示例12: xprofile_action_delete_avatar

/**
 * This function runs when an action is set for a screen:
 * example.com/members/andy/profile/change-avatar/ [delete-avatar]
 *
 * The function will delete the active avatar for a user.
 *
 * @package BuddyPress Xprofile
 * @uses bp_core_delete_avatar() Deletes the active avatar for the logged in user.
 * @uses add_action() Runs a specific function for an action when it fires.
 */
function xprofile_action_delete_avatar()
{
    if (!bp_is_user_change_avatar() || !bp_is_action_variable('delete-avatar', 0)) {
        return false;
    }
    // Check the nonce
    check_admin_referer('bp_delete_avatar_link');
    if (!bp_is_my_profile() && !bp_current_user_can('bp_moderate')) {
        return false;
    }
    if (bp_core_delete_existing_avatar(array('item_id' => bp_displayed_user_id()))) {
        bp_core_add_message(__('Your avatar was deleted successfully!', 'buddypress'));
    } else {
        bp_core_add_message(__('There was a problem deleting that avatar, please try again.', 'buddypress'), 'error');
    }
    bp_core_redirect(wp_get_referer());
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:27,代码来源:bp-xprofile-actions.php

示例13: friends_screen_requests

/**
 * Catch and process the Requests page.
 */
function friends_screen_requests()
{
    if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_accept_friendship');
        if (friends_accept_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship accepted', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_reject_friendship');
        if (friends_reject_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship rejected', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('cancel', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_withdraw_friendship');
        if (friends_withdraw_friendship(bp_loggedin_user_id(), bp_action_variable(1))) {
            bp_core_add_message(__('Friendship request withdrawn', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship request could not be withdrawn', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    }
    /**
     * Fires before the loading of template for the friends requests page.
     *
     * @since BuddyPress (1.0.0)
     */
    do_action('friends_screen_requests');
    /**
     * Filters the template used to display the My Friends page.
     *
     * @since BuddyPress (1.0.0)
     *
     * @param string $template Path to the friends request template to load.
     */
    bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:48,代码来源:bp-friends-screens.php

示例14: bp_forums_directory_forums_setup

function bp_forums_directory_forums_setup() {
	global $bp;

	if ( $bp->current_component == $bp->forums->slug ) {
		if ( (int) $bp->site_options['bp-disable-forum-directory'] || !function_exists( 'groups_install' ) )
			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->root_domain );
		}

		$bp->is_directory = true;

		do_action( 'bbpress_init' );

		/* Check to see if the user has posted a new topic from the forums page. */
		if ( isset( $_POST['submit_topic'] ) && function_exists( 'bp_forums_new_topic' ) ) {
			/* Check the nonce */
			check_admin_referer( 'bp_forums_new_topic' );

			if ( $bp->groups->current_group = groups_get_group( array( 'group_id' => $_POST['topic_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, $bp->groups->current_group->id );

				if ( $forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' ) ) {
					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' );
					else
						bp_core_add_message( __( 'The topic was created successfully', 'buddypress') );

					bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . '/forum/topic/' . $topic->topic_slug . '/' );
				} else {
					bp_core_add_message( __( 'Please pick the group forum where you would like to post this topic.', 'buddypress' ), 'error' );
				}
			}
		}

		do_action( 'bp_forums_directory_forums_setup' );

		bp_core_load_template( apply_filters( 'bp_forums_template_directory_forums_setup', 'forums/index' ) );
	}
}
开发者ID:n-sane,项目名称:zaroka,代码行数:44,代码来源:bp-forums.php

示例15: bp_group_reviews_extension

 function bp_group_reviews_extension()
 {
     global $bp;
     $this->group_id = BP_Groups_Group::group_exists($bp->current_item);
     $this->name = __('Reviews', 'bpgr');
     $this->slug = $bp->group_reviews->slug;
     $this->nav_item_position = 22;
     $this->enable_create_step = false;
     $this->enable_nav_item = BP_Group_Reviews::current_group_is_available();
     $this->enable_edit_item = false;
     if (isset($_POST['review_submit'])) {
         check_admin_referer('review_submit');
         $has_posted = '';
         if (empty($_POST['review_content']) || !(int) $_POST['rating']) {
             // Something has gone wrong. Save the user's submitted data to reinsert into the post box after redirect
             $cookie_data = array('review_content' => $_POST['review_content'], 'rating' => $_POST['rating']);
             $cookie = json_encode($cookie_data);
             setcookie('bpgr-data', $cookie, time() + 60 * 60 * 24, COOKIEPATH);
             bp_core_add_message(__("Please make sure you fill in the review, and don't forget to provide a rating!", 'bpgr'), 'error');
         } else {
             /* 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, $bp->loggedin_user->id);
             }
             if ($rating_id = $this->post_review(array('content' => $_POST['review_content'], 'rating' => (int) $_POST['rating']))) {
                 bp_core_add_message("Your review was posted successfully!");
                 $has_posted = groups_get_groupmeta($bp->groups->current_group->id, 'posted_review');
                 if (!in_array((int) $bp->loggedin_user->id, (array) $has_posted)) {
                     $has_posted[] = (int) $bp->loggedin_user->id;
                 }
                 groups_update_groupmeta($bp->groups->current_group->id, 'posted_review', $has_posted);
                 if ((int) $_POST['rating'] < 0) {
                     $_POST['rating'] = 1;
                 }
                 if ((int) $_POST['rating'] > 5) {
                     $_POST['rating'] = 5;
                 }
             } else {
                 bp_core_add_message("There was a problem posting your review, please try again.", 'error');
             }
         }
         bp_core_redirect(apply_filters('bpgr_after_post_redirect', trailingslashit(bp_get_group_permalink($bp->groups->current_group) . $this->slug, $has_posted)));
     }
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:44,代码来源:classes.php


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