Skip to:
Content

BuddyPress.org

Ticket #8540: 8540.1.suggestions.patch

File 8540.1.suggestions.patch, 5.0 KB (added by imath, 2 years ago)
  • src/bp-members/classes/class-bp-signup.php

    diff --git src/bp-members/classes/class-bp-signup.php src/bp-members/classes/class-bp-signup.php
    index b0f1d6673..c95409082 100644
    class BP_Signup { 
    104104                global $wpdb;
    105105
    106106                // Get BuddyPress.
    107                 $bp    = buddypress();
     107                $bp = buddypress();
    108108
    109109                // Check cache for signup data.
    110110                $signup = wp_cache_get( $this->id, 'bp_signups' );
    class BP_Signup { 
    138138                $this->meta           = maybe_unserialize( $signup->meta );
    139139
    140140                // Add richness.
    141                 $this->avatar         = get_avatar( $signup->user_email, 32 );
    142                 $this->user_name      = ! empty( $this->meta['field_1'] ) ? wp_unslash( $this->meta['field_1'] ) : '';
     141                $this->avatar    = get_avatar( $signup->user_email, 32 );
     142                $this->user_name = ! empty( $this->meta['field_1'] ) ? wp_unslash( $this->meta['field_1'] ) : '';
    143143
    144144                // When was the activation email sent?
    145                 if ( isset( $this->meta['sent_date'] ) ) {
     145                if ( isset( $this->meta['sent_date'] ) && '0000-00-00 00:00:00' !== $this->meta['sent_date'] ) {
    146146                        $this->date_sent = $this->meta['sent_date'];
     147
     148                        // Sent date defaults to date of registration.
    147149                } else {
    148                         $this->date_sent = '0000-00-00 00:00:00';
     150                        $this->date_sent = $signup->registered;
    149151                }
    150152
    151153                /**
    152154                 * Calculate a diff between now & last time
    153155                 * an activation link has been resent.
    154156                 */
    155                 $sent_at = mysql2date('U', $this->date_sent );
     157                $sent_at = mysql2date( 'U', $this->date_sent );
    156158                $now     = current_time( 'timestamp', true );
    157159                $diff    = $now - $sent_at;
    158160
    class BP_Signup { 
    201203                global $wpdb;
    202204
    203205                $bp = buddypress();
    204                 $r  = bp_parse_args( $args,
     206                $r  = bp_parse_args(
     207                        $args,
    205208                        array(
    206209                                'offset'         => 0,
    207210                                'number'         => 1,
    class BP_Signup { 
    300303
    301304                // We only want the IDs.
    302305                if ( 'ids' === $r['fields'] ) {
    303 
    304306                        $paged_signups = array_map( 'intval', $paged_signup_ids );
    305307
    306308                } else {
    307 
    308309                        $uncached_signup_ids = bp_get_non_cached_ids( $paged_signup_ids, 'bp_signups' );
    309310                        if ( $uncached_signup_ids ) {
    310311                                $signup_ids_sql      = implode( ',', array_map( 'intval', $uncached_signup_ids ) );
    class BP_Signup { 
    318319                        foreach ( $paged_signup_ids as $paged_signup_id ) {
    319320                                $paged_signups[] = new BP_Signup( $paged_signup_id );
    320321                        }
    321 
    322322                }
    323323
    324324                // Find the total number of signups in the results set.
    class BP_Signup { 
    368368        public static function add( $args = array() ) {
    369369                global $wpdb;
    370370
    371                 $r = bp_parse_args( $args,
     371                $r = bp_parse_args(
     372                        $args,
    372373                        array(
    373374                                'domain'         => '',
    374375                                'path'           => '',
    class BP_Signup { 
    446447        public static function add_backcompat( $user_login = '', $user_password = '', $user_email = '', $usermeta = array() ) {
    447448                global $wpdb;
    448449
    449                 $user_id = wp_insert_user( array(
    450                         'user_login'   => $user_login,
    451                         'user_pass'    => $user_password,
    452                         'display_name' => sanitize_title( $user_login ),
    453                         'user_email'   => $user_email
    454                 ) );
     450                $user_id = wp_insert_user(
     451                        array(
     452                                'user_login'   => $user_login,
     453                                'user_pass'    => $user_password,
     454                                'display_name' => sanitize_title( $user_login ),
     455                                'user_email'   => $user_email
     456                        )
     457                );
    455458
    456459                if ( is_wp_error( $user_id ) || empty( $user_id ) ) {
    457460                        return $user_id;
    class BP_Signup { 
    493496                                                $vfield           = xprofile_get_field( $field_id, null, false );
    494497                                                $visibility_level = isset( $vfield->default_visibility ) ? $vfield->default_visibility : 'public';
    495498                                        }
     499
    496500                                        xprofile_set_field_visibility_level( $field_id, $user_id, $visibility_level );
    497501                                }
    498502                        }
    class BP_Signup { 
    634638        public static function update( $args = array() ) {
    635639                global $wpdb;
    636640
    637                 $r = bp_parse_args( $args,
     641                $r = bp_parse_args(
     642                        $args,
    638643                        array(
    639644                                'signup_id'  => 0,
    640645                                'meta'       => array(),
    class BP_Signup { 
    708713                        return false;
    709714                }
    710715
    711                 $to_resend = self::get( array(
    712                         'include' => $signup_ids,
    713                 ) );
     716                $to_resend = self::get(
     717                        array(
     718                                'include' => $signup_ids,
     719                        )
     720                );
    714721
    715722                if ( ! $signups = $to_resend['signups'] ) {
    716723                        return false;
    class BP_Signup { 
    764771                        }
    765772
    766773                        // Update metas.
    767                         $result['resent'][] = self::update( array(
    768                                 'signup_id' => $signup->signup_id,
    769                                 'meta'      => $meta,
    770                         ) );
     774                        $result['resent'][] = self::update(
     775                                array(
     776                                        'signup_id' => $signup->signup_id,
     777                                        'meta'      => $meta,
     778                                )
     779                        );
    771780                }
    772781
    773782                /**
    class BP_Signup { 
    803812                        return false;
    804813                }
    805814
    806                 $to_activate = self::get( array(
    807                         'include' => $signup_ids,
    808                 ) );
     815                $to_activate = self::get(
     816                        array(
     817                                'include' => $signup_ids,
     818                        )
     819                );
    809820
    810821                if ( ! $signups = $to_activate['signups'] ) {
    811822                        return false;
    class BP_Signup { 
    887898                        return false;
    888899                }
    889900
    890                 $to_delete = self::get( array(
    891                         'include' => $signup_ids,
    892                 ) );
     901                $to_delete = self::get(
     902                        array(
     903                                'include' => $signup_ids,
     904                        )
     905                );
    893906
    894907                if ( ! $signups = $to_delete['signups'] ) {
    895908                        return false;