• Resolved scormeny

    (@scormeny)


    I like the SMCF plugin and would like to ask if there’s a way to include the URL of the web page (or title of the WP page/post) on which the form was accessed, in the body of the email that is delivered. I’m using this on a site where I am hoping to ask people to contact my client with specific questions about the post that they’re looking at, so that would be REALLY useful!

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter scormeny

    (@scormeny)

    Sorry to be a pest about this — when I originally posted three days ago, there were some strange issues that prevented me from tagging this topic or elaborating with a reply. Now I can do that, so please consider this a (hopefully better-worded) “bump”.

    I would like to include the permalink of the page that the person filled out the SMCF form on, to the content that comes in the body of the email message.

    Is it possible to call the permalink in the plugin, and then add it to the body of the email message? I feel like it should be easy to do, but not for a php n00b like me.

    Thanks.

    Thread Starter scormeny

    (@scormeny)

    Eric Martin and I corresponded directly with each other. Here’s what he sent me, which did what I wanted:

    In js/smcf.js, change:

    data: $('#smcf-container form').serialize() + '&action=send',

    To:

    data: $('#smcf-container form').serialize() +
    '&action=send&permalink=' + encodeURIComponent(location.href),

    Then in smcf_data.php, below:

    if (get_option("smcf_ua")) {
    	$message .= "\n\nUSER AGENT: " . $_SERVER["HTTP_USER_AGENT"];
    }

    Add:

    $permalink = isset($_POST["permalink"]) ? $_POST["permalink"] : "";
    if ($permalink) {
    	$message .= "\n\nPERMALINK: " . $permalink;
    }

    Make sure to clear your browser cache if it’s not working for you right away, or get a friend to test it from another computer.

    Thank you, Eric!

    This question was resolved via email. Here was the proposed solution:

    There are a number of ways to accomplish your request, but try
    this out and see if it fits your needs:

    In js/smcf.js, change:

    data: $('#smcf-container form').serialize() + '&action=send',

    To:

    data: $('#smcf-container form').serialize() +
    '&action=send&permalink=' + encodeURIComponent(location.href),

    Then in smcf_data.php, below:

    if (get_option("smcf_ua")) {
           $message .= "\n\nUSER AGENT: " . $_SERVER["HTTP_USER_AGENT"];
    }

    Add:

    if (isset($_POST["permalink"])) {
       $message .= "\n\nPERMALINK: " . isset($_POST["permalink"]);
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘SimpleModal Contact Form question’ is closed to new replies.