I also emailed Ninja Forms support about this and they blamed it on PHP, so I went into the source and found a filter where I can modify the success message. This filter will find all email addresses in the success message and replace + with %2B.
add_filter( 'ninja_forms_run_action_settings', function( $action, $form_id, $action_id ) {
if ( isset( $action['type'] ) && 'successmessage' === $action['type'] ) {
preg_match( '/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i', $action['success_msg'], $matches );
if ( $matches ) {
foreach ( $matches as $match ) {
$email_encoded = str_replace( '+', '%2B', $match );
$action['success_msg'] = str_replace( $match, $email_encoded, $action['success_msg'] );
}
}
}
return $action;
}, 10, 3 );
I should add that my filter works in my case because the only email address is the one that gets passed into the query string of a link. If you have any email addresses in the success message that aren’t in a query string or href then this filter shouldn’t be used because it’ll display those emails with %2B in them.
Plugin Support
Mia
(@xmiax)
Hi.
Thanks for reaching out. I’m Mia and I work for Ninja Forms. As we outline in this post, we prefer supporting our users on NinjaForms.com so we can better track issues. I can give you a quick answer to this question, but if more details are needed I’ll have to refer you to our normal support system.
I asked the engineering team to make sure I was giving you the correct information. This is a limitation of the PHP url_encode() function. The querystring is a URL and URL encoding converts characters into a format that can be used in a browser. URLs can’t have the + sign in them so the + sign is interpreted as a space. It’s not something we can work around at this time.
You can use the code supplied by the other user if you like. However, we can’t offer support for custom code.
Thanks for choosing Ninja Forms for your website.
Mia