Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Contact Plugin
#52
Hi there,

i tried to make some customization for getting a "call me" - form. But it doens't send any email. Maybe because i deleted the captcha?

Would be awesome, if somebody could help me.

Thank you very much!

You can find the website here: http://solarshare.martonos.de

Code:
<?php

$sc_to = 'my-emailadress';

# get correct id for plugin
$thisfile = basename(__FILE__, ".php");

# register plugin
register_plugin(
    $thisfile,    # ID of plugin, should be filename minus php
    'Simple Contact',    # Title of plugin
    '1.1',    # Version of plugin
    'internet54',    # Author of plugin
    'http://internet54.com',    # Author URL
    'This plugin will install a simple contact form into your website.',    # Plugin Description
    'plugins',    # Page type of plugin
    'sc_options'    # Function that displays content
);

add_action('plugins-sidebar', 'createSideMenu', array($thisfile, 'Simple Contact'));
/////////////////////////////////////////

// Show options in plugin page
function sc_options() {
    print "<h2>How to get this thing working?</h2>
    <p>Please add this line of code in your template files where you want your contact form to display. For example
    place this code into your contact template file so it displays on that page.  This plugin is set to display the form right below the content of the page.<br />
    <p><strong>if (function_exists('sc_show')) { sc_show(); }</strong><br />
    Make sure to wrap it in php tags.</p>";
}

// PHP mail function
function sc_mail () {
    global $successmsg;
    global $sc_to;
    $error = 0;
    if( isset($_POST['sc_submitted']) ) {
        $sc_email = $_POST['sc_email'];
        if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$sc_email )){
            $successmsg = "<div style=\"color:red; text-align:center;\">Invalid email address entered.</div>";
            $error = 1;
        }
        if ( empty($_POST['sc_name']) || empty($_POST['sc_email']) || empty($_POST['sc_subject']) || empty($_POST['sc_zeit'])) {
            $successmsg = "<p class=\"error\"><a href=\"#rueckruf\">Bitte alle Felder ausfüllen &raquo;</a> - <a href=\"#rueckruf\" onclick=\"return false\"  class=\"hide2\">Nachricht ausblenden</a></p>";
            $error = 1;
        }

        if ($error != 1){
            $from = "From: " .$_POST['sc_email'];
            $message = "Name: ".$_POST['sc_name'];
            $message = $message."\n". "Name: ".$_POST['sc_name'];
            $message = $message."\n". "Telefonnummer: ".$_POST['sc_nummer'];
            $message = $message."\n". "Wunschzeit: ".$_POST['sc_zeit'];
            mail($sc_to, $_POST['sc_subject'], $message, $from);
            $successmsg = "<p class=\"success\">Vielen Dank, wir haben ihren Rückrufwunschtermin erhalten.<br /> <a href=\"#\" class=\"hide\" onclick=\"return false\">Nachricht ausblenden &raquo;</a></p>";
            //Clear values
            $_POST = array();
        }
    } else {
        $successmsg = "";
    }
}

// Form Display
function sc_form () {
    global $successmsg;
    print '<div id="sc-container">';
    print $successmsg;
    print '<form action="" method="post" id="rueckruf" class="contactform" >
    <div><label>Name:</label> <input class="text" type="text" value="" name="sc_name" /></div>
    <div><label>Telefonnummer:</label> <input class="text" type="text" value="" name="sc_nummer" /></div>    
    <div><label>Gewünschte Rückrufzeit</label> <textarea class="text" name="sc_zeit" ></textarea></div>    
    <input type="hidden" value="Rückrufformular - solarshare.de" name="sc_subject" />
    <input type="hidden" value="formular@solarshare.de" name="sc_email" />
    <div><input type="submit" value="Abschicken" id="contact-submit" name="contact-submit" /></div>
    <input type="hidden" value="true" name="sc_submitted" />
    
    </form>
    </div>';
}

// Run the plugin in the theme
function sc_show() {
    global $thisfile;
    add_action('content-top', 'sc_mail', array($thisfile, 'Simple Contact'));
    add_action('content-bottom', 'sc_form', array($thisfile, 'Simple Contact'));
}
?>
Reply


Messages In This Thread
Simple Contact Plugin - by internet54 - 2010-03-05, 15:10:47
Simple Contact Plugin - by ccagle8 - 2010-03-05, 21:30:59
Simple Contact Plugin - by bnowell - 2010-03-06, 00:37:46
Simple Contact Plugin - by internet54 - 2010-03-06, 01:14:11
Simple Contact Plugin - by bnowell - 2010-03-06, 02:21:06
Simple Contact Plugin - by internet54 - 2010-03-06, 02:34:36
Simple Contact Plugin - by Zegnåt - 2010-03-06, 03:40:10
Simple Contact Plugin - by matt - 2010-03-06, 04:48:05
Simple Contact Plugin - by Zegnåt - 2010-03-06, 07:12:28
Simple Contact Plugin - by internet54 - 2010-03-06, 08:50:02
Simple Contact Plugin - by matt - 2010-03-06, 10:07:35
Simple Contact Plugin - by internet54 - 2010-03-10, 06:11:38
Simple Contact Plugin - by spilarix - 2010-03-23, 08:53:09
Simple Contact Plugin - by internet54 - 2010-03-23, 11:08:04
Simple Contact Plugin - by Zegnåt - 2010-03-23, 16:33:26
Simple Contact Plugin - by spilarix - 2010-03-24, 01:21:17
Simple Contact Plugin - by kotos - 2010-04-01, 21:52:59
Simple Contact Plugin - by spilarix - 2010-04-02, 19:07:58
Simple Contact Plugin - by mouffin - 2010-04-04, 01:36:09
Simple Contact Plugin - by Oleg06 - 2010-04-04, 05:25:31
Simple Contact Plugin - by Oleg06 - 2010-04-06, 19:52:27
Simple Contact Plugin - by spilarix - 2010-04-07, 00:22:19
Simple Contact Plugin - by Oleg06 - 2010-04-07, 03:31:04
Simple Contact Plugin - by internet54 - 2010-04-07, 08:08:01
Simple Contact Plugin - by Oleg06 - 2010-04-11, 00:59:53
Simple Contact Plugin - by banter - 2010-04-12, 07:00:09
Simple Contact Plugin - by El-Cherubin - 2010-05-17, 05:25:53
Simple Contact Plugin - by morgenmuffel - 2010-05-17, 10:28:02
Simple Contact Plugin - by an8dres26h - 2010-05-18, 04:46:13
Simple Contact Plugin - by morgenmuffel - 2010-05-18, 07:06:26
Simple Contact Plugin - by Oleg06 - 2010-05-18, 16:13:52
Simple Contact Plugin - by an8dres26h - 2010-05-19, 01:14:12
Simple Contact Plugin - by morgenmuffel - 2010-05-19, 07:41:23
Simple Contact Plugin - by morgenmuffel - 2010-05-19, 08:46:10
Simple Contact Plugin - by NickC - 2010-05-20, 20:06:54
Simple Contact Plugin - by an8dres26h - 2010-05-21, 02:34:15
Simple Contact Plugin - by samrayner - 2010-05-22, 21:07:35
Simple Contact Plugin - by Oleg06 - 2010-05-22, 23:45:58
Simple Contact Plugin - by morgenmuffel - 2010-05-23, 08:38:12
Simple Contact Plugin - by Oleg06 - 2010-05-23, 16:22:13
Simple Contact Plugin - by cscott - 2010-06-17, 06:05:17
Simple Contact Plugin - by folieplus - 2010-07-07, 20:25:08
Simple Contact Plugin - by yojoe - 2010-07-08, 03:44:37
Simple Contact Plugin - by folieplus - 2010-07-08, 19:31:33
Simple Contact Plugin - by suprchic66 - 2010-07-09, 06:32:20
Simple Contact Plugin - by morgenmuffel - 2010-07-17, 10:30:35
Simple Contact Plugin - by Zegnåt - 2010-07-17, 20:06:32
Simple Contact Plugin - by morgenmuffel - 2010-07-20, 14:36:14
Simple Contact Plugin - by core - 2010-07-22, 00:26:25
Simple Contact Plugin - by simple123 - 2010-07-29, 04:33:28
Simple Contact Plugin - by NeBox - 2010-08-06, 23:35:36
Simple Contact Plugin - by martonos - 2010-08-07, 02:31:57
Simple Contact Plugin - by morgenmuffel - 2010-08-07, 09:57:27
Simple Contact Plugin - by internet54 - 2010-08-19, 13:19:34
Simple Contact Plugin - by vsky - 2010-08-19, 15:03:21
Simple Contact Plugin - by fotothink - 2010-08-19, 20:46:53
Simple Contact Plugin - by internet54 - 2010-08-19, 23:08:19
Simple Contact Plugin - by morgenmuffel - 2010-08-20, 07:18:25
Simple Contact Plugin - by fotothink - 2010-08-20, 18:34:56
Simple Contact Plugin - by vsky - 2010-08-20, 20:33:32
Simple Contact Plugin - by fotothink - 2010-08-20, 21:09:38
Simple Contact Plugin - by vsky - 2010-08-20, 21:19:45
Simple Contact Plugin - by fotothink - 2010-08-21, 01:20:17
Simple Contact Plugin - by vsky - 2010-08-21, 05:01:29
Simple Contact Plugin - by fotothink - 2010-08-21, 15:26:25
Simple Contact Plugin - by Rene - 2010-08-25, 17:19:12
Simple Contact Plugin - by 9dogs - 2010-09-04, 09:24:25
Simple Contact Plugin - by tankmiche - 2010-09-12, 20:13:12
Simple Contact Plugin - by rozmiar - 2010-09-15, 23:35:27
Simple Contact Plugin - by vsky - 2010-09-16, 09:25:19
Simple Contact Plugin - by rozmiar - 2010-09-24, 19:50:14
Simple Contact Plugin - by mikesalami - 2011-04-08, 09:49:36



Users browsing this thread: 2 Guest(s)