Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/10/2021 04:13:57 PM (3 years ago)
Author:
dcavins
Message:

BP_Signup improvements.

On multisite, when resending actvation emails, send the
right kind (user or user + site). Also ensure that default
meta is set via wpmu meta filters.

introduce bp_members_get_signup_by() and
bp_members_site_requests_enabled().

Correct default value calculation in BP_Signup
to allow backcompat.

See #8540.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-filters.php

    r12912 r13165  
    474474    );
    475475
    476     $signups = BP_Signup::get(
    477         array(
    478             'user_login' => $user,
    479         )
    480     );
    481 
     476    $signup     = bp_members_get_signup_by( 'activation_key', $key );
    482477    $salutation = $user;
    483     if ( $signups && bp_is_active( 'xprofile' ) ) {
    484         $signup = $signups['signups'][0];
     478    if ( $signup && bp_is_active( 'xprofile' ) ) {
    485479        if ( isset( $signup->meta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) {
    486480            $salutation = $signup->meta[ 'field_' . bp_xprofile_fullname_field_id() ];
     
    563557}
    564558add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1, 4 );
     559
     560/**
     561 * Ensure that some meta values are set for new multisite signups.
     562 *
     563 * @since 10.0.0
     564 *
     565 * @see wpmu_signup_user() for a full description of params.
     566 *
     567 * @param array $meta Signup meta data. Default empty array.
     568 * @return array Signup meta data.
     569 */
     570function bp_core_add_meta_to_multisite_signups( $meta ) {
     571
     572    // Ensure that sent_date and count_sent are set in meta.
     573    if ( ! isset( $meta['sent_date'] ) ) {
     574        $meta['sent_date'] = '0000-00-00 00:00:00';
     575    }
     576    if ( ! isset( $meta['count_sent'] ) ) {
     577        $meta['count_sent'] = 0;
     578    }
     579
     580    return $meta;
     581}
     582add_filter( 'signup_user_meta', 'bp_core_add_meta_to_multisite_signups' );
     583add_filter( 'signup_site_meta', 'bp_core_add_meta_to_multisite_signups' );
    565584
    566585/**
Note: See TracChangeset for help on using the changeset viewer.