• Resolved propeltoexcel

    (@propeltoexcel)


    Hi there,

    I have followed this thread to get a shortcode to be displayed in the html field: https://www.ads-software.com/support/topic/using-shortcode-in-forminator/#post-12881666

    I haven’t been able to get it to work yet.

    At the moment I have added ‘forminator-render-shotycodes.php’ into my ‘mu-plugins’ folder with the following code:

    <?php
    // Render shortcode on HTML fields
    add_filter( 'forminator_replace_variables', 'do_shortcode' );
    // Include shortcode output to hidden field
    add_filter( 'forminator_custom_form_submit_field_data', function( $field_data_array ){
        
        $form = array(
            'field' => 'html-1', // Form html field
            'shortcode' => '[wp24_domaincheck]' // Shortcode to be rendered
        );
    
        foreach( $field_data_array as &$field_single ){
            if( $field_single['name'] === $form['field'] ){
                $field_single['value'] = strip_tags( do_shortcode( $form['shortcode'] ) );
            }
        }
    
        return $field_data_array;
    
    });

    I tried to include the following code of @ckgrafico, but I am not sure how. It doesn’t work for me atm.

    function forminator_callback($html) {
    	// WordPress does not like to use shortcodes in html attributes
    	preg_match_all('|(="\[.*\])(.*)(\[\/.*\])|U', $html, $matches);
    	$codes = $matches[0];
    
    	if (!$codes) {
    		return do_shortcode($html);
    	}
    
    	foreach ($codes as $code) {
    		$html = str_replace($code, do_shortcode($code), $html);
    	}
    	
    	return do_shortcode($html);
    }
    add_filter( 'forminator_render_fields_markup', 'forminator_callback' );

    Hoping you can help me with this issue.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @propeltoexcel

    I hope you are doing well.

    On the first code, can you please replace your filter from:

    forminator_custom_form_submit_field_data

    to

    forminator_form_submit_field_data

    I tested on my lab site and it worked fine after this update.

    Let us know the result you got.
    Best Regards
    Patrick Freitas

    Thread Starter propeltoexcel

    (@propeltoexcel)

    Many thanks for your support Pat!

    Thread Starter propeltoexcel

    (@propeltoexcel)

    It works like a charm

    Thread Starter propeltoexcel

    (@propeltoexcel)

    The plugin I am using the short code for is called ‘WP24 Domain Check’. It is a two part system whereby you fill in the desired domain, click check, followed by a domain search with the results showing as per picture attached.

    The first part (form) is showing in Forminator, however, when I press check it wont show the second part (the results). Is that easily solvable with one of your magic codes?

    https://imgur.com/a/cawrBKc

    Thank you.

    Thread Starter propeltoexcel

    (@propeltoexcel)

    The screenshot attached is of the ‘WP24 Domain Check’ plugin outside the Forminator form.

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @propeltoexcel

    I hope you’re well today!

    I tested it and it seems this is quite specific case. The problem is that this shortcode needs to submit data which, if inside form, causes form submission and that breaks entire process.

    If you disable “Form” option in WP24 Domain Check plugin, the conflict causing Forminator form submission is gone but then also the domain check breaks so that’s not a solution either.

    But maybe there’d be some other “way around it” then? Can you describe the case scenario a bit more? I mean – is it necessary to have this check actually inside Forminator’s form field? I’m thinking that maybe there could be some other way to integrate it but we’d need to know the purpose of such integration first.

    Best regards,
    Adam

    Thread Starter propeltoexcel

    (@propeltoexcel)

    Thanks for asking Adam,

    my intent is to have the form user select an available domain and submit it through the forminator form itself. The domain check avoids the form user to select a domain that isnt available.

    Hope that makes sense.

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @propeltoexcel

    I pinged our SLS Team to review your query> Please note this sounds out of scope and we cannot guarantee anything. Thank you for your patience while we look into this further.

    Kind Regards,
    Kris

    Thread Starter propeltoexcel

    (@propeltoexcel)

    Thanks Kris,

    That is more than I could ask for.

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @propeltoexcel

    My colleague Kris asked our Second Line Support about the issue and we already got feedback on this. Unfortunately, in this case it would require custom integration with the WP24 Domain Check plugin – a custom developed code that would “connect” both plugins.

    I’m afraid this is out of the scope of support that we could provide.

    But there may be a simpler workaround: if there’s some relatively simple way to redirect user after checking the domain to another page (maybe via the “hooks” that WP24 Domain Check provide? you may want to ask them for assistance with it) you could use it to put domain check on one page and then redirect to second page that would include form.

    Forminator forms can use “pre-populate field” option which means that a field can be set to be auto-filled with a value from URL (query var). If there’d be a way to make that domain check redirect to separate page with a form, it could make a usable workaround.

    Best regards,
    Adam

    Thread Starter propeltoexcel

    (@propeltoexcel)

    Thanks true, good point. I might look into it, or just settle with a link to a domain check website as the process you recommend does sound quite complicated.

    Thanks for following up on me.

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @propeltoexcel

    Had you tried a PopUp maybe?

    You can configure a button on your HTML field [ check domain ] and trigger the form WP24 Domain as a PopUp.

    In case don’t have any PopUp plugin you can find our plugin at
    https://www.ads-software.com/plugins/wordpress-popup/

    Best Regards
    Patrick Freitas

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @propeltoexcel

    I hope you are doing well and safe!

    We haven’t heard from you in a while, I’ll mark this thread as resolved.

    Feel free to let us know if you have any additional questions or problems.

    Best Regards
    Patrick Freitas

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Including a shortcode into html field’ is closed to new replies.