How to turn off Discourse email verification?

Yes, WordPress doesn’t require email addresses to be verified, but it’s important for Discourse that the email address is verified (that it belongs to the user who has registered.) The WP Discourse plugin hooks into the WordPress registration process and verifies that the email sent by wp_new_user_notification was responded to. It’s not possible for the plugin to do this with custom registration systems, so if one of those systems is being used, it forces Discourse to verify the email address.

If you know that your user’s email address are verified, you can add a function that hooks into the discourse_email_verification filter. It passes two parameters: $require_activation and $user_id

Something like this will work. Be careful about this though. The conditional in the function should be dependent on something that happens in your registration process that lets you know the email address has been verified.

add_filter( 'discourse_email_verification', 'wpdc_custom_discourse_email_verification', 10, 2 );
function wpdc_custom_discourse_email_verification( $require_activation, $user_id ) {
    if (/* some condition */) {
        $require_activation = false;
    }

    return $require_activation;
}
7 Likes