• Resolved 8bit7

    (@8bit7)


    After a user has already verified they can go back and reclick the link, which crashes the page. Instead, can we show them a message or just send them to the homepage or the return page thats set in the form…or just something better than crashing the page and giving the user information that could pose a security issue for some of us.

    Anything I can put in my functions.php or a custom plugin to fix this?

    Thanks!

    The user is already active.
    This message was triggered by forminator.
    
    Call stack:
    
    wp_die()
    wp-content/plugins/forminator/library/modules/custom-forms/user/class-forminator-cform-user-data.php:292
    Forminator_CForm_User_Data->admin_approve_user_by_link()
    wp-includes/class-wp-hook.php:308
    do_action_ref_array('wp')
    wp-includes/class-wp.php:797
    WP->main()
    wp-includes/functions.php:1334
    wp()
    wp-blog-header.php:16
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @8bit7,

    Possible to share the form export so that we could have a better idea regarding the issues noticed and see what could be suggested further?

    Please check the following doc on how to export a form:
    https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export

    If you are concerned about any sensitive information in the form, then you can duplicate your form, remove any sensitive information, and then export it.

    You can share the export file via Google Drive, Dropbox or any cloud services in the next reply.

    Looking forward to your response.

    Kind Regards,
    Nithin

    Thread Starter 8bit7

    (@8bit7)

    Thanks for the help and quick reply. Here is the form.

    https://file.io/pgtILj8wUSF7

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @8bit7

    Thank you,

    I was able to replicate this screen, I didn’t dig deep in the code but that screen happens when a plugin or theme uses the wp_die(), this doesn’t mean a fatal error but expected behaviour defined by the developer, however, I agree we could implement a better interface to handle this situation. We will pass this feedback to the plugin team,

    Best Regards
    Patrick Freitas

    Thread Starter 8bit7

    (@8bit7)

    Awesome ??

    Any recommendation to fix it until an official fix comes out? I know these things can take a while and I need something now. I can make a custom plugin and shove some code in it if needed no problem.

    Thanks!

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @8bit7

    I don’t have an ETA on the change implementation and there’s no easy way to override that as there’s no related filters built-in into Formiantor.

    But I looked closer into it and came up with a bit “dirty tricK” that could possibly be used as a workaround. Please note though: it is really a “trick” and not quite an “official way” to do things – I tested it and it works on my end but I can’t promise that it won’t affect some other features/plugins on site. It should not, but if you decide to apply it, be aware, please that you do it at your own risk.

    The trick is to override the default handler for core wp_die() function and make it execute redirect to custom page in case specific message happens.

    The code is as follows:

    <?php 
    
    add_filter( 'wp_die_handler', 'formi_custom_user_wpdie_handler', 11, 1 );
    
    function formi_custom_user_wpdie_handler( $message ) {
    	
    	return 'formi_custom_user_wpdie_function';	
    	
    }
    
    function formi_custom_user_wpdie_function( $message, $title, $args ) {
    	
    	if ( $message == 'The user is already active.' ) {
    		wp_redirect( 'URL_TO_CUSTOM_PAGE_HERE' );
    		exit();
    	}
    	call_user_func( '_default_wp_die_handler', $message, $title, $args );
    	
    
    }

    First, you need to makes ure that in this line

    if ( $message == 'The user is already active.' ) {

    the text is matching exactly the message that is displayed on your page. For example, if the language is different, you need to adjust it accordingly.

    Second, you must replace URL_TO_CUSTOM_PAGE_HERE with an actual URL of the publicly visible page on your site – you would want to just create a page with some custom error message.

    Finally, add the code to the site:

    – create an empty file with a .php extension (e.g. “forminator-activation-existing-msg-patch.php”)
    – copy and paste code into it
    – and upload the file to the “/wp-content/mu-plugins” folder of your site’s WP installation.

    The way this code does is
    – it replaces default function that is called by wp_die() function with our own
    – and in our own function we first check if it’s a specific error message
    – if yes, we do redirect (and that’s it)
    – if not, we just call the original function

    Best regards,
    Adam

    Thread Starter 8bit7

    (@8bit7)

    omg wow man, thank you for going above and beyond! You are a hero!

    Thread Starter 8bit7

    (@8bit7)

    Was finally able to install and test. worked great. Thanks again! Marking as resolved.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Error after verifying user’ is closed to new replies.