The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Unable to dynamically change the frm_redirect_url inside a shortcode.

Labels

This Discussion is public

Notifications

Is it possible to add an attribute to a formidable shortcode that would allow you to set the redirect success_url? I've tried the formidable_shortcode_atts hook with no luck:

add_action('formidable_shortcode_atts', 'formidable_shortcode_atts', 20, 2);
function formidable_shortcode_atts( $atts, $all_atts )
{
    if ( isset( $all_atts[ 'redirect_url' ] ) ) {
        // do something to update the success_url in the form. 
    }
}

I know that there is a frm_redirect_url hook, but I haven't been able to make that work inside of my shortcode.

The action you are hooking into is called in only one place in FrmFormsController.php in the get_form_shortcode function. And, there's already a function named formidable_shortcode_atts in FrmProFormsController.php.

To be able to redirect to a different url you have to hook into something that executes when the form is saved. Why not just call the frm_redirect_url filter directly? What exactly are you trying to do?

I guess where I went wrong was that I didn't know that I had to hook into something that executed when the form was saved. I was attempting to do a runtime change of the redirect url. For example, adding a [formidable id=1 redirect_to="https://google.com"], to change the redirect action of the form to google.com.

Discussion closed.