Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/31/2021 09:47:06 PM (3 years ago)
Author:
dcavins
Message:

Introduce $active parameter for BP_Signup::get().

Allow the BP_Signup::get() method to fetch

  • activated signups only (active = 1)
  • not-yet-activated signups only (active = 0) - the default case
  • signups with any active status (active = false)

This change means that users following an activation key
for an already-activated account will get a more helpful
error message telling them the account is already activated.

Props Jean-David.

Fixes #7938.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/classes/class-bp-signup.php

    r13098 r13099  
    256256     *     @type string      $activation_key Activation key to search for. If specified, all other
    257257     *                                       parameters will be ignored.
     258     *     @type int|bool    $active         Pass 0 for inactive signups, 1 for active signups,
     259     *                                       and `false` to ignore.
    258260     *     @type string      $user_login     Specific user login to return.
    259261     *     @type string      $fields         Which fields to return. Specify 'ids' to fetch a list of signups IDs.
     
    279281                'include'        => false,
    280282                'activation_key' => '',
     283                'active'         => 0,
    281284                'user_email'     => '',
    282285                'user_login'     => '',
     
    320323             */
    321324        } else {
     325            // Active.
     326            if ( false !== $r['active'] ) {
     327                $sql['where'][] = $wpdb->prepare( "active = %d", absint( $r['active'] ) );
     328            }
    322329
    323330            // Search terms.
Note: See TracChangeset for help on using the changeset viewer.