Bug #791


URL params are stripped in bp_core_no_access() redirects

Added by Boone Gorges about 12 years ago. Updated almost 12 years ago.

Priority name:
Category name:
BuddyPress (misc)
Target version:
Start date:
Due date:
% Done:


Estimated time:
Deployment actions:


See #227.

When attempting to visit access-restricted pages while not logged in, bp_core_no_access() redirects to wp-login.php, with a redirect_to argument of the originally requested URL. However, additional URL parameters are not being included in the redirect_to URL. Eg,
gets redirected to

This is probably just a function of how wp-login.php and wp_redirect() work, but it's worth spending a little bit of time figuring out whether it's something that can be avoided.

Actions #1

Updated by Raymond Hoh about 12 years ago

Just thinking off the top of my head, but I believe the $redirect variable in bp_core_no_access() might need to use trailingslashit().
At least this gives me a chance to try out BP Docs :)

Will give my theory a try a little later!

Actions #2

Updated by Raymond Hoh about 12 years ago

Problem occurs on line 180 of buddypress-docs/includes/integration-bp.php

Instead of using bp_core_redirect(), you could use the new bp_core_no_access() function! :)

You can try this instead:

            if ( !bp_docs_current_user_can( 'view_history' ) ) {
                if ( function_exists( 'bp_core_no_access' )  ) {
                    if ( is_user_logged_in() )
                        bp_core_no_access( array( 'redirect' => false, 'message' => __( 'You do not have permission to view this Doc\'s history.', 'bp-docs' ) ) );
                // old compatibility
                else {
                    // The user does not have edit permission. Redirect.
                    bp_core_add_message( __( 'You do not have permission to view this Doc\'s history.', 'bp-docs' ), 'error' );

                    $doc = bp_docs_get_current_doc();

                    $redirect = bp_docs_get_doc_link( $doc->ID );

                    // Redirect back to the Doc list view
                    bp_core_redirect( $redirect ); 
Actions #3

Updated by Boone Gorges about 12 years ago

  • Assignee changed from Raymond Hoh to Boone Gorges

Cool - thanks for tracking it down, Ray!

I see two different things going on here. One is that I should use bp_core_no_access() if available. The other is that I should concatenate the redirect URL differently in the case of the 'history' tab.


I'll take care of this as I gear up for the next release. Thanks!

Actions #4

Updated by Boone Gorges almost 12 years ago

  • Status changed from Assigned to Resolved

Fixed in in BuddyPress Docs. It'll come into the Commons on the next update.


Also available in: Atom PDF