• Resolved orion42

    (@orion42)


    I edited the script to auto-insert the email into the input text box.
    – Check if email is passed by url => if ( isset($_GET[’email’]))
    – Check if email is passed by form (e.g. from widget) => if ( isset($_POST[’email’]))

    In this way we can insert a mail into the widget and if we wrote wrong we can see the mistake.
    Or we can pass the email variable by url. E.g. using a link directed to a page with S2 Form, or linking from some page outside in wordpress

    I edited in class-s2-frontend.php, row40 :

    // build default form

    if ( isset($_GET[’email’])){ // 42 – If email is passed by url, insert it into input form
    $email_into_form = $_GET[’email’];

    $this->form = “<form method=\”post\” action=\”” . $url . “\”><input type=\”hidden\” name=\”ip\” value=\”” . $_SERVER[‘REMOTE_ADDR’] . “\” /><p><label for=\”s2email\”>” . __(‘Your email:’, ‘subscribe2’) . “</label>
    <input type=\”text\” name=\”email\” id=\”s2email\” value=\””. $email_into_form .”\” size=\”” . $size . “\” /></p><p>” . $this->input_form_action . “</p></form>”;

    }elseif ( isset($_POST[’email’])){ // 42 – If email is passed by post (e.g. from widget), insert it into input form
    $email_into_form = $_POST[’email’];

    $this->form = “<form method=\”post\” action=\”” . $url . “\”><input type=\”hidden\” name=\”ip\” value=\”” . $_SERVER[‘REMOTE_ADDR’] . “\” /><p><label for=\”s2email\”>” . __(‘Your email:’, ‘subscribe2’) . “</label>
    <input type=\”text\” name=\”email\” id=\”s2email\” value=\””. $email_into_form .”\” size=\”” . $size . “\” /></p><p>” . $this->input_form_action . “</p></form>”;

    }else{ // 42 – If email in not passed neither by GET or POST is passed then use standard mode
    if ( $nojs == ‘true’ ) {
    $this->form = “<form method=\”post\” action=\”” . $url . “\”><input type=\”hidden\” name=\”ip\” value=\”” . $_SERVER[‘REMOTE_ADDR’] . “\” /><p><label for=\”s2email\”>” . __(‘Your email:’, ‘subscribe2’) . “</label>
    <input type=\”text\” name=\”email\” id=\”s2email\” value=\”\” size=\”” . $size . “\” /></p><p>” . $this->input_form_action . “</p></form>”;
    } else {
    $this->form = “<form method=\”post\” action=\”” . $url . “\”><input type=\”hidden\” name=\”ip\” value=\”” . $_SERVER[‘REMOTE_ADDR’] . “\” /><p><label for=\”s2email\”>” . __(‘Your email:’, ‘subscribe2’) . “</label>
    <input type=\”text\” name=\”email\” id=\”s2email\” value=\”” . __(‘Enter email address…’, ‘subscribe2’) . “\” size=\”” . $size . “\” onfocus=\”if (this.value == ‘” . __(‘Enter email address…’, ‘subscribe2’) . “‘) {this.value = ”;}\” onblur=\”if (this.value == ”) {this.value = ‘” . __(‘Enter email address…’, ‘subscribe2’) . “‘;}\” /></p><p>” . $this->input_form_action . “</p></form>\r\n”;
    }

    http://wordpress.org/extend/plugins/subscribe2/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Subscribe2] Suggest:Auto insert email in input text if ispassed by GET (url) or POST(widget’ is closed to new replies.