BP_Signup::delete( array $signup_ids = array() )
Delete a pending account.
Description
Parameters
- $signup_ids
-
(Optional) Single ID or list of IDs to delete.
Default value: array()
Return
(array)
Source
File: bp-members/classes/class-bp-signup.php
public static function delete( $signup_ids = array() ) { global $wpdb; if ( empty( $signup_ids ) || ! is_array( $signup_ids ) ) { return false; } $to_delete = self::get( array( 'include' => $signup_ids, ) ); if ( ! $signups = $to_delete['signups'] ) { return false; } $result = array(); /** * Fires before deletion of pending accounts. * * @since BuddyPress 2.0.0 * * @param array $signup_ids Array of pending IDs to delete. */ do_action( 'bp_core_signup_before_delete', $signup_ids ); foreach ( $signups as $signup ) { $user_id = username_exists( $signup->user_login ); if ( ! empty( $user_id ) && $signup->activation_key === bp_get_user_meta( $user_id, 'activation_key', true ) ) { if ( 2 != self::check_user_status( $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 { bp_core_delete_account( $user_id ); } } if ( empty( $result['errors'][ $signup->signup_id ] ) ) { $wpdb->delete( // Signups table. buddypress()->members->table_name_signups, // Where. array( 'signup_id' => $signup->signup_id, ), // WHERE sanitization format. array( '%d', ) ); $result['deleted'][] = $signup->signup_id; } } /** * Fires after deletion of pending accounts. * * @since BuddyPress 2.0.0 * * @param array $signup_ids Array of pending IDs to delete. * @param array $result Array of data for deleted accounts. */ do_action( 'bp_core_signup_after_delete', $signup_ids, $result ); /** * Filters the result of the metadata for deleted pending accounts. * * @since BuddyPress 2.0.0 * * @param array $result Updated metadata related to deleted pending accounts. */ return apply_filters( 'bp_core_signup_delete', $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.