Skip to content

Instantly share code, notes, and snippets.

@TimBHowe
Created May 2, 2018 17:35
Show Gist options
  • Save TimBHowe/595ee478aa7cab4441e5ccd286159916 to your computer and use it in GitHub Desktop.
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.
<?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 );
@TimBHowe
Copy link
Author

TimBHowe commented May 2, 2018

Please use with caution. This will most likely not be comparable with BuddyPress 3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment