• Resolved pmdf

    (@pmdf)


    The code described in the FAQ for manually inserting forms into templates is no longer working for me – all my forms on various sites are broken in v4x.

    For example, I’m using:

    if ( isset($si_contact_form) ) {
    echo $si_contact_form->si_contact_form_short_code( array(
     'form' => '2',
     'email_to' => "$ec_name,$ec_mailto",
     ) );
    }

    if ( isset($si_contact_form) ) seems to be returning false and if I remove the test then I get an error “Fatal error: Call to a member function si_contact_form_short_code() on a non-object in (mypage url)”.

    Would be grateful for any assistance to get this working again. Thanks.

    http://wordpress.org/plugins/si-contact-form/

Viewing 4 replies - 1 through 4 (of 4 total)
  • I don’t have time right now I have to go work a 12 hour shift, but would you test this fix?
    Let me know as soon as possible if it works.

    Edit the si-contact-form.php

    Just after
    FSCF_Util::setup();

    add this code:

    if (!class_exists('siContactForm')) {
       class siContactForm {
          function si_contact_form_short_code($atts) {
             // backwards compatibility with manual PHP call from 3.xx
             FSCF_Display::process_short_code($atts);
          }
       }
     }
    $si_contact_form = new siContactForm();

    Also because you are using the ’email_to’ attribute…
    You have to go to the Tools tab for the Form 2 and check the setting
    “Enable PHP sessions.”

    If you don’t “Enable PHP sessions.”, the ’email_to’ attribute will be ignored.

    Enables PHP session handling. Default is not enabled. You can enable this setting to use PHP sessions for shortcode attributes and the CAPTCHA. PHP Sessions must be supported by your web host or there may be session errors. This setting affects all forms.

    Thread Starter pmdf

    (@pmdf)

    Thanks for getting back on this Mike.

    Adding that code results in isset($si-contact-form) returning true now, but the form still isn’t displayed and there’s no error message either. I have php sessions enabled.

    The “do_shortcode” format works fine, but I don’t know how to pass an ’email_to’ attribute that way, if that’s even possible. [edit – just found the tip on adding this attribute using the shortcode, so that should work as a fix for me].

    The code I posted was close, it was missing a echo command.

    Fixed in 4.0.9
    (02 Oct 2013) – Bug fix: PHP method of calling form display was not working.
    – Bug fix: time validation did not work on 24 hour format.

    This version is compatible with either method.

    Thread Starter pmdf

    (@pmdf)

    Yep, the echo has fixed it for me too. Many thanks for the fix.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Manual Template Code’ is closed to new replies.