Skip to:
Content

BuddyPress.org

Ticket #8542: 8542.patch

File 8542.patch, 3.7 KB (added by imath, 3 years ago)
  • src/bp-members/bp-members-invitations.php

    diff --git src/bp-members/bp-members-invitations.php src/bp-members/bp-members-invitations.php
    index 4a7951f24..75cb997ca 100644
    function bp_members_invitations_complete_signup( $user_id, $user_login = '', $us 
    126126        // User has already verified their email by responding to the invitation, so we can activate.
    127127        $key = bp_get_user_meta( $user_id, 'activation_key', true );
    128128        if ( $key ) {
     129                $redirect = bp_get_activation_page();
     130
    129131                /**
    130132                 * Filters the activation signup.
    131133                 *
    function bp_members_invitations_complete_signup( $user_id, $user_login = '', $us 
    138140
    139141                // If there were errors, add a message and redirect.
    140142                if ( ! empty( $user->errors ) ) {
     143                        /**
     144                         * Filter here to redirect the User to a different URL than the activation page.
     145                         *
     146                         * @since 10.0.0
     147                         *
     148                         * @param string   $redirect The URL to use to redirect the user.
     149                         * @param WP_Error $user     The WP Error object.
     150                         */
     151                        $redirect = apply_filters( 'bp_members_invitations_activation_errored_redirect', $redirect, $user );
     152
    141153                        bp_core_add_message( $user->get_error_message(), 'error' );
    142                         bp_core_redirect( trailingslashit( bp_get_root_domain() . '/' . $bp->pages->activate->slug ) );
     154                        bp_core_redirect( $redirect );
    143155                }
    144156
     157                /**
     158                 * Filter here to redirect the User to a different URL than the activation page.
     159                 *
     160                 * @since 10.0.0
     161                 *
     162                 * @param string   $redirect The URL to use to redirect the user.
     163                 */
     164                $redirect = apply_filters( 'bp_members_invitations_activation_successed_redirect', $redirect );
     165
    145166                bp_core_add_message( __( 'Your account is now active!', 'buddypress' ) );
    146                 bp_core_redirect( add_query_arg( 'activated', '1', bp_get_activation_page() ) );
     167                bp_core_redirect( add_query_arg( 'activated', '1', $redirect ) );
    147168        }
    148169}
    149170add_action( 'bp_core_signup_user', 'bp_members_invitations_complete_signup', 10, 4 );
  • src/bp-members/screens/activate.php

    diff --git src/bp-members/screens/activate.php src/bp-members/screens/activate.php
    index 581a6fd7d..2fc9e7e96 100644
    function bp_members_action_activate_account() { 
    8585                return;
    8686        }
    8787
    88         $bp = buddypress();
     88        $bp       = buddypress();
     89        $redirect = bp_get_activation_page();
    8990
    9091        /**
    9192         * Filters the activation signup.
    function bp_members_action_activate_account() { 
    99100
    100101        // If there were errors, add a message and redirect.
    101102        if ( ! empty( $user->errors ) ) {
     103                /**
     104                 * Filter here to redirect the User to a different URL than the activation page.
     105                 *
     106                 * @since 10.0.0
     107                 *
     108                 * @param string   $redirect The URL to use to redirect the user.
     109                 * @param WP_Error $user     The WP Error object.
     110                 */
     111                $redirect = apply_filters( 'bp_members_action_activate_errored_redirect', $redirect, $user );
     112
    102113                bp_core_add_message( $user->get_error_message(), 'error' );
    103                 bp_core_redirect( trailingslashit( bp_get_root_domain() . '/' . $bp->pages->activate->slug ) );
     114                bp_core_redirect( $redirect );
    104115        }
    105116
     117        /**
     118         * Filter here to redirect the User to a different URL than the activation page.
     119         *
     120         * @since 10.0.0
     121         *
     122         * @param string   $redirect The URL to use to redirect the user.
     123         */
     124        $redirect = apply_filters( 'bp_members_action_activate_successed_redirect', $redirect );
     125
    106126        bp_core_add_message( __( 'Your account is now active!', 'buddypress' ) );
    107         bp_core_redirect( add_query_arg( 'activated', '1', bp_get_activation_page() ) );
     127        bp_core_redirect( add_query_arg( 'activated', '1', $redirect ) );
    108128
    109129}
    110 add_action( 'bp_actions', 'bp_members_action_activate_account' );
    111  No newline at end of file
     130add_action( 'bp_actions', 'bp_members_action_activate_account' );