How to Deactivate the Discourse Activation Email


(Ryan Collins) #1

Hi team,

Is it possible to deactivate the requirement to verify emails with discourse?

I am using Discourse with my Wordpress website connected via SSO.

In my situation, it just doesn’t make sense for users to be required to verify their email.

Just curious.

Thanks!


(Simon Cossar) #3

Unless the default WordPress New User Notification email is sent as a part of your WordPress registration process, the plugin sets the SSO parameter require_activation to true. There is a hook that you can use to bypass this. The hook is called discourse_email_verification. It passes two parameters:

  • $require_activation - whether or not the email address has been validated by WordPress
  • $user - the WordPress user object

If you want to disable email validation for all users, then you don’t need to use the parameters. You can add something like this to your theme’s functions.php file or a plugin:

Note: don’t use this unless you know that your user’s email addresses are valid.

add_filter( 'discourse_email_verification', 'wpdc_custom_disable_email_verification' );
function wpdc_custom_disable_email_verification() {

    return false;
}

(Ryan Collins) #4

Thank you Simon!

I will get to work on this and let you know if I have any questions. I really appreciate the reply.