Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/05/2014 07:01:09 PM (11 years ago)
Author:
boonebgorges
Message:

When a user changes her email address, require email verification of the new address

This feature, built into WordPress MS by default (when updating one's profile
via the Dashboard), ensures that new email addresses are valid and not
mistyped, helping to avoid unintentionally locked-out accounts.

Fixes #2265

Props j.conti for an initial patch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-settings/bp-settings-template.php

    r6317 r8560  
    5656        return apply_filters( 'bp_get_settings_root_slug', buddypress()->settings->root_slug );
    5757    }
     58
     59/**
     60 * Add the 'pending email change' message to the settings page.
     61 *
     62 * @since BuddyPress (2.1.0)
     63 */
     64function bp_settings_pending_email_notice() {
     65    $pending_email = bp_get_user_meta( bp_displayed_user_id(), 'pending_email_change', true );
     66
     67    if ( empty( $pending_email['newemail'] ) ) {
     68        return;
     69    }
     70
     71    if ( bp_get_displayed_user_email() == $pending_email['newemail'] ) {
     72        return;
     73    }
     74
     75    ?>
     76
     77    <div id="message" class="bp-template-notice error">
     78        <p><?php printf( __( 'There is a pending change of your email address to <code>%1$s</code>.<br />Check your email (<code>%2$s</code>) for the verification link. <a href="%3$s">Cancel</a>', 'buddypress' ), $pending_email['newemail'], bp_get_displayed_user_email(), esc_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/?dismiss_email_change=1' ) ) ?></p>
     79    </div>
     80
     81    <?php
     82}
     83add_action( 'bp_before_member_settings_template', 'bp_settings_pending_email_notice' );
Note: See TracChangeset for help on using the changeset viewer.