BP_Signup::activate( array $signup_ids = array() )
Activate a pending account.
Description
Parameters
- $signup_ids
-
(Optional) Single ID or list of IDs to activate.
Default value: array()
Return
(array)
Source
File: bp-members/classes/class-bp-signup.php
public static function activate( $signup_ids = array() ) { if ( empty( $signup_ids ) || ! is_array( $signup_ids ) ) { return false; } $to_activate = self::get( array( 'include' => $signup_ids, ) ); if ( ! $signups = $to_activate['signups'] ) { return false; } $result = array(); /** * Fires before activation of user accounts. * * @since BuddyPress 2.0.0 * * @param array $signup_ids Array of IDs to activate. */ do_action( 'bp_core_signup_before_activate', $signup_ids ); foreach ( $signups as $signup ) { $user = bp_core_activate_signup( $signup->activation_key ); if ( ! empty( $user->errors ) ) { $user_id = username_exists( $signup->user_login ); if ( 2 !== self::check_user_status( $user_id ) ) { $user_id = false; } if ( empty( $user_id ) ) { // Status is not 2, so user's account has been activated. $result['errors'][ $signup->signup_id ] = array( $signup->user_login, esc_html__( 'the sign-up has already been activated.', 'buddyboss' ) ); // Repair signups table. self::validate( $signup->activation_key ); // We have a user id, account is not active, let's delete it. } else { $result['errors'][ $signup->signup_id ] = array( $signup->user_login, $user->get_error_message() ); } } else { $result['activated'][] = $user; } } /** * Fires after activation of user accounts. * * @since BuddyPress 2.0.0 * * @param array $signup_ids Array of IDs activated activate. * @param array $result Array of data for activated accounts. */ do_action( 'bp_core_signup_after_activate', $signup_ids, $result ); /** * Filters the result of the metadata after user activation. * * @since BuddyPress 2.0.0 * * @param array $result Updated metadata related to user activation. */ return apply_filters( 'bp_core_signup_activate', $result ); }
Changelog
Version | Description |
---|---|
BuddyPress 2.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.