Skip to:
Content

BuddyPress.org

Changeset 5767


Ignore:
Timestamp:
02/13/2012 09:16:47 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Use server info instead of wp_guess_url() in bp_core_no_access(). Fixes #3976. Props lackingpenguin, r-a-y.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-catchuri.php

    r5760 r5767  
    439439function bp_core_no_access( $args = '' ) {
    440440
     441    // Build the redirect URL
     442    $redirect_url  = is_ssl() ? 'https://' : 'http://';
     443    $redirect_url .= $_SERVER['HTTP_HOST'];
     444    $redirect_url .= $_SERVER['REQUEST_URI'];
     445
    441446    $defaults = array(
    442         'mode'     => '1',              // 1 = $root, 2 = wp-login.php
    443         'message'  => __( 'You must log in to access the page you requested.', 'buddypress' ),
    444         'redirect' => wp_guess_url(),   // the URL you get redirected to when a user successfully logs in
    445         'root'     => bp_get_root_domain()  // the landing page you get redirected to when a user doesn't have access
     447        'mode'     => '1',                  // 1 = $root, 2 = wp-login.php
     448        'redirect' => $redirect_url,        // the URL you get redirected to when a user successfully logs in
     449        'root'     => bp_get_root_domain(), // the landing page you get redirected to when a user doesn't have access
     450        'message'  => __( 'You must log in to access the page you requested.', 'buddypress' )
    446451    );
    447452
     
    460465
    461466    switch ( $mode ) {
     467
    462468        // Option to redirect to wp-login.php
    463469        // Error message is displayed with bp_core_no_access_wp_login_error()
    464470        case 2 :
    465             if ( $redirect ) {
    466                 bp_core_redirect( wp_login_url( $redirect ) . '&action=bpnoaccess' );
     471            if ( !empty( $redirect ) ) {
     472                bp_core_redirect( add_query_arg( array( 'action' => 'bpnoaccess' ), wp_login_url( $redirect ) ) );
    467473            } else {
    468474                bp_core_redirect( $root );
Note: See TracChangeset for help on using the changeset viewer.