Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    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&pagetitle=' + encodeURIComponent(document.title),

    Then in smcf_data.php, below:

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

    Add:

    if (isset($_POST["pagetitle"])) {
       $message .= "\n\nPage Title: " . isset($_POST["pagetitle"]);
    }

    I haven’t tested it, so let me know if you have any issue.

    -Eric

    Mike

    (@maddogmike)

    I’m interested in this, too. I’d prefer to have the page title included in the body of the email rather than the subject, but either way will work. I tried the above, but it didn’t work. Any other suggestions?

    Rose

    (@thorned-rose)

    @pnelsen I did this by altering smcf.php by changing line (about) 209 to this:

    if (get_option("smcf_form_subject") == 1) {
    			$output .= "
    				    <input type='hidden' id='smcf-subject' class='smcf-input' name='subject' value='". single_post_title('Enquiry about ', false) . "' readonly='readonly' tabindex='1003' />";

    You will probably need to change the “single_post_title” to whatever type of page you have as single_post_title is specific to (funnily enough) the title of a single post page (the_title may work, but I don’t remember as that can only be used within the loop).

    @mike You can do the same thing above – just add value='". single_post_title('Enquiry about ', false) . "' to the <textarea id=’smcf-message’> on line (about) 215 (bearing in mind that you will also need to change single_post_title to whatever type of page it is.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: SimpleModal Contact Form (SMCF)] Adding the page title to the subject line of email’ is closed to new replies.