Created
May 2, 2018 17:35
-
-
Save TimBHowe/595ee478aa7cab4441e5ccd286159916 to your computer and use it in GitHub Desktop.
BuddyPress version 2.9.4: Auto verify new emails when users update them in their profiles.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Auto verify user email changes. | |
* | |
* @return void | |
*/ | |
function custombp_auto_verify_email_change() { | |
// Double check this is happening on the settings page. | |
check_admin_referer('bp_settings_general'); | |
// Get the current users id from the display. | |
$pending_email = bp_get_user_meta( bp_displayed_user_id(), 'pending_email_change', true ); | |
// Set the $_GET var with the proper hash. | |
$_GET['verify_email_change'] = $pending_email['hash']; | |
// Call the verification function | |
bp_settings_verify_email_change(); | |
} | |
add_action( 'bp_core_general_settings_after_save', 'custombp_auto_verify_email_change', 10, 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please use with caution. This will most likely not be comparable with BuddyPress 3.0.0