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