• Hi there.

    I am trying to have the contact form do two things.

    [si-contact-form form=’3′ send_pdf=’/wp-content/uploads/2012/02/PCI_DSS-ViewIntus.pdf’ redirect=’/compliance/pci-compliance/’]

    Fromthe line above, you can see what I want,

    first, send the pdf located at ‘/wp-content/uploads/2012/02/PCI_DSS-ViewIntus.pdf’
    second, once it has be sent, redirect the current page to ‘/compliance/pci-compliance/’

    This will allow the site visitor to click a menu item that will open a new page, which has only the form. It will ask for the form to be filled, when submit has been pressed, the user will have the pdf open in a NEW page and the current page gets the page they started from.

    Now, how can I do this? or do I have to give Mike some money? If so, how much ?

    Jerry

    https://www.ads-software.com/extend/plugins/si-contact-form/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter pentego

    (@pentego)

    A little more.

    I have tried to edit the si-contact-form.php at about line 448 and added:
    ————
    extract(shortcode_atts(array(
    ‘form’ => ”,
    ‘redirect’ => ”,
    ‘send_pdf’ => ”,
    ‘hidden’ => ”,
    ’email_to’ => ”,
    ), $atts));
    —————–

    with the change being ‘send_pdf’.

    Also, edited line 464 to add
    ————-
    $shortcode_send_pdf = $send_pdf;
    ————-

    I also edited the line around 745 to include the pdf name on the page title

    ————–
    document.title=’Redirecting in ‘ + $shortcode_send_pdf + ‘ — ‘+ ctf_redirect_seconds + ‘ seconds’;
    ————–

    But, the title does not get the pdf name, the redirect just hangs…

    Any help would be great.

    Jerry

    Thread Starter pentego

    (@pentego)

    So, just a thought,

    instead of ‘send_pdf’, is there a way to have the redirect open a new window with some specified URL and then, redirect to the URL specified in the ‘redirect’ shortcode option?

    sort of like this

    [si-contact-form form=’3′ open=’new_URL’ redirect=’URL’]

    is this doable ?

    Thread Starter pentego

    (@pentego)

    GOT IT!!!!!

    Here are the changes in case someone else wants to do it as well.

    In your document, the shortcode is
    [si-contact-form form=’3′ send_pdf=’new_URL’ redirect=’URL’]

    in ‘si-contact-form.php’ file, there are 4 changes:
    1) at about line 454, add “‘send_pdf’ => ”,” to the list.

    ————
    extract(shortcode_atts(array(
    ‘form’ => ”,
    ‘redirect’ => ”,
    ‘send_pdf’ => ”,
    ‘hidden’ => ”,
    ’email_to’ => ”,
    ), $atts));
    ————–

    2) at about line 470 add “$shortcode_send_pdf = $send_pdf;”
    ————-
    // https://www.fastsecurecontactform.com/shortcode-options
    $shortcode_redirect = $redirect;
    $shortcode_send_pdf = $send_pdf;
    $shortcode_hidden = $hidden;
    $shortcode_email_to = $email_to;
    ————-

    3) at about line 758, add this
    if(‘$shortcode_send_pdf’ != ”)
    window.open(‘$shortcode_send_pdf’, “_blank”, “toolbar=no, location=no, directories=no, status=no, menubar=no, width=400, height=400”);
    so the function ctf_redirect() looks like this

    —————-
    function ctf_redirect() {
    document.title=’Redirecting in ‘ + ctf_redirect_seconds + ‘ seconds’;
    ctf_redirect_seconds=ctf_redirect_seconds-1;
    ctf_redirect_time=setTimeout(“ctf_redirect()”,1000);
    if (ctf_redirect_seconds==-1) {
    clearTimeout(ctf_redirect_time);
    document.title=’Redirecting …’;
    self.location=’$ctf_redirect_url’;
    if(‘$shortcode_send_pdf’ != ”)
    `window.open(‘$shortcode_send_pdf’, “_blank”, “toolbar=no, location=no, directories=no, status=no, menubar=no, width=400, height=400”);
    }
    }
    —————-

    Thread Starter pentego

    (@pentego)

    Sorry, goofed.. only 3 changes.

    pentego,

    That was creative of you to figure that out. nice!
    I will test this myself and possible make it an available feature.

    Thanks

    Mike

    Thread Starter pentego

    (@pentego)

    Mike, thanks.

    Here is an updated version. Works better.

    First, the window.open line has changed.

    window.open("/path_to_PHP_script/send_pdf.php?pdf=" + '$shortcode_send_pdf', "_blank", "width=100, height=100");

    The script “send_pdf.php” is
    [Code moderated as per the Forum Rules. Please use the pastebin]

    Thread Starter pentego

    (@pentego)

    Now, the real trick would be to have it tied to the submit button….

    Anyone know how I could do that ???

    Jerry

    Thread Starter pentego

    (@pentego)

    The send_pdf.php script is here: https://pastebin.com/KJf563kH

    Sorry, did not know about policy that requires php code to go to pastebin…

    Jerry

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Fast Secure Contact Form] redirect and send pdf ???’ is closed to new replies.