[Solved] Fatal error with User mail verification


#1

edit : I’d like to override the discourse’s email verification process… is that doable ? I’m using WP-Discourse obviously

Hey guys, I’m trying to mix Memberpress and User Verification (for email verifying) to prevent Discourse from sending another email for validating. (Is that clear ? Probably not lmao)

But when the user signup on wordpress and validates his email, an error appears. Do you have any idea on what I should do to prevent that from happening ? Thank you

Error =

**Fatal error** : Uncaught ArgumentCountError: Too few arguments to function WPDiscourse\WordPressEmailVerification\WordPressEmailVerification::verify_email_after_login(), 1 passed in /home/----/public_html/wp-includes/class-wp-hook.php on line 286 and exactly 2 expected in /home/----/public_html/wp-content/plugins/wp-discourse/lib/wordpress-email-verification.php:128 Stack trace: #0 /home/----/public_html/wp-includes/class-wp-hook.php(286): WPDiscourse\WordPressEmailVerification\WordPressEmailVerification->verify_email_after_login('----') #1 /home/----/public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array) #2 /home/----/public_html/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #3 /home/----/public_html/wp-content/plugins/user-verification/includes/functions.php(514): do_action('wp_login', '----') #4 /home/----/public_html/wp-includes/class-wp-hook.php(286): user_verification_auto_login('') #5 /home/----/public_html/wp-includes/class-wp-hook.php(310) in **/home/----/public_html/wp-content/plugins/wp-discourse/lib/wordpress-email-verification.php** on line **128**


(Simon Cossar) #2

Have you altered the plugin’s code?


#3

I didn’t touch any plugin code


(Simon Cossar) #4

Are you calling the function verify_email_after_login from somewhere? It is not meant to be called directly. It shouldn’t be possible for that function to receive too few arguments. It is called by the wp_login action. That action passes two arguments to the function - $username and $user.


#5

Mhh the plugin UserVerification uses the variable $user_name instead of $username, do you think it can provokes a bug ?


(Simon Cossar) #6

No, changing the variable name won’t have an effect. What is the UserVerification plugin? I can take a look at it.


#7

Oh that’d be great thank you, here’s the link : User Verification | WordPress.org I have the free version


(Simon Cossar) #8

That plugin calls the wp_login action but only passes the username as a variable.

do_action( 'wp_login', $user->user_login );

This will break any other plugin that is correctly hooking into the action.

It should be calling it like this:

do_action( 'wp_login', $user->user_login, $user );

#9

Yes sir it worked, thanks a lot !