Changeset 11927 for trunk/src/bp-members/bp-members-actions.php
- Timestamp:
- 04/02/2018 03:51:24 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-actions.php
r11766 r11927 108 108 } 109 109 110 /**111 * Catches and processes account activation requests.112 *113 * @since 3.0.0114 */115 function bp_members_action_activate_account() {116 if ( ! bp_is_current_component( 'activate' ) ) {117 return;118 }119 120 if ( is_user_logged_in() ) {121 return;122 }123 124 if ( ! empty( $_POST['key'] ) ) {125 $key = wp_unslash( $_POST['key'] );126 127 // Backward compatibility with templates using `method="get"` in their activation forms.128 } elseif ( ! empty( $_GET['key'] ) ) {129 $key = wp_unslash( $_GET['key'] );130 }131 132 if ( empty( $key ) ) {133 return;134 }135 136 $bp = buddypress();137 138 /**139 * Filters the activation signup.140 *141 * @since 1.1.0142 *143 * @param bool|int $value Value returned by activation.144 * Integer on success, boolean on failure.145 */146 $user = apply_filters( 'bp_core_activate_account', bp_core_activate_signup( $key ) );147 148 // If there were errors, add a message and redirect.149 if ( ! empty( $user->errors ) ) {150 bp_core_add_message( $user->get_error_message(), 'error' );151 bp_core_redirect( trailingslashit( bp_get_root_domain() . '/' . $bp->pages->activate->slug ) );152 }153 154 bp_core_add_message( __( 'Your account is now active!', 'buddypress' ) );155 bp_core_redirect( add_query_arg( 'activated', '1', bp_get_activation_page() ) );156 157 }158 add_action( 'bp_actions', 'bp_members_action_activate_account' );159 160 110 /* 161 111 * Unhooked in 1.6.0 - moved to settings 162 112 * add_action( 'bp_actions', 'bp_core_action_delete_user' ); 163 113 */ 164 165 /**166 * Redirect to a random member page when visiting a ?random-member URL.167 *168 * @since 1.0.0169 */170 function bp_core_get_random_member() {171 if ( ! isset( $_GET['random-member'] ) )172 return;173 174 $user = bp_core_get_users( array( 'type' => 'random', 'per_page' => 1 ) );175 bp_core_redirect( bp_core_get_user_domain( $user['users'][0]->id ) );176 }177 add_action( 'bp_actions', 'bp_core_get_random_member' );
Note: See TracChangeset
for help on using the changeset viewer.