Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/22/2015 09:44:36 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Review r9109 and r9203, and clean up bp_core_screen_activation() to improve readability and separate a few procedural tasks. Fixes #5831.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-screens.php

    r9351 r9400  
    290290/**
    291291 * Handle the loading of the Activate screen.
     292 *
     293 * @todo Move the actual activation process into an action in bp-members-actions.php
    292294 */
    293295function bp_core_screen_activation() {
    294     global $bp;
    295 
    296     if ( !bp_is_current_component( 'activate' ) )
     296   
     297    // Bail if not viewing the activation page
     298    if ( ! bp_is_current_component( 'activate' ) ) {
    297299        return false;
    298 
    299     // If the user is logged in, redirect away from here
     300    }
     301
     302    // If the user is already logged in, redirect away from here
    300303    if ( is_user_logged_in() ) {
    301         if ( bp_is_component_front_page( 'activate' ) ) {
    302             $redirect_to = trailingslashit( bp_get_root_domain() . '/' . bp_get_members_root_slug() );
    303         } else {
    304             $redirect_to = trailingslashit( bp_get_root_domain() );
    305         }
     304
     305        // If activation page is also front page, set to members directory to
     306        // avoid an infinite loop. Otherwise, set to root domain.
     307        $redirect_to = bp_is_component_front_page( 'activate' )
     308            ? bp_get_root_domain() . '/' . bp_get_members_root_slug()
     309            : bp_get_root_domain();
     310
     311        // Trailing slash it, as we expect these URL's to be
     312        $redirect_to = trailingslashit( $redirect_to );
    306313
    307314        /**
     
    312319         * @param string $redirect_to URL to redirect user to.
    313320         */
    314         bp_core_redirect( apply_filters( 'bp_loggedin_activate_page_redirect_to', $redirect_to ) );
    315 
    316         return;
     321        $redirect_to = apply_filters( 'bp_loggedin_activate_page_redirect_to', $redirect_to );
     322
     323        // Redirect away from the activation page
     324        bp_core_redirect( $redirect_to );
    317325    }
    318326
     
    324332        $key = bp_current_action();
    325333    }
     334
     335    // Get BuddyPress
     336    $bp = buddypress();
    326337
    327338    // we've got a key; let's attempt to activate the signup
Note: See TracChangeset for help on using the changeset viewer.