Plugin Directory

Changeset 1629009


Ignore:
Timestamp:
04/04/2017 09:18:25 AM (9 years ago)
Author:
racanu
Message:

Added full name to anti-robot page; no checks yet on syntax

Location:
keep-in-touch/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • keep-in-touch/trunk/class-keep-in-touch-db.php

    r1628720 r1629009  
    5050    }
    5151   
    52     static function register_subscription_request($email, $code)
     52    static function register_subscription_request($email, $code, $full_name)
    5353    {
    5454        global $wpdb;
     
    6363                    'code' => $code,
    6464                    'status' => 'pending_activation',
     65                    'full_name' => $full_name,
    6566                ),
    6667                array(
     
    8081                'weekly' => true,
    8182                'newsletter' => true,
     83                'full_name' => $full_name,
    8284            )
    8385        );
  • keep-in-touch/trunk/class-keep-in-touch-msg.php

    r1628704 r1629009  
    4444                '<form method="post" action="' . home_url(Keep_In_Touch_Utils::get_page_path_from_slug(Keep_In_Touch_Utils::$PAGE_SLUG)) . '">' .
    4545                '<input type="hidden" name="keep_in_touch_email_reference" value="' . $email . '" />' .
    46                 '<input type="hidden" placeholder="' . __('Enter your name', 'keep-in-touch') . '" name="keep_in_touch_full_name" value="" />' .
     46                '<input type="text" placeholder="' . __('Enter your name', 'keep-in-touch') . '" name="keep_in_touch_full_name" value="" style="width:100%"/>' .
    4747                '<input type="text" placeholder="' . __('Enter email', 'keep-in-touch') . '" name="keep_in_touch_email" value="" style="width:100%" />' .
    4848                '<br /><input type="submit" name="keep_in_touch_submit" value="' . __('Sign up', 'keep-in-touch') . '" />' .
  • keep-in-touch/trunk/keep-in-touch.php

    r1628720 r1629009  
    9191
    9292        $email = sanitize_email($_POST['keep_in_touch_email']);
    93         if (!isset($_POST['keep_in_touch_email_reference']))
     93        if (!self::is_null_or_empty_string($_POST['keep_in_touch_email_reference']))
     94            $email_reference = sanitize_email($_POST['keep_in_touch_email_reference']);
     95        if (!self::is_null_or_empty_string($_POST['keep_in_touch_full_name']))
     96            $full_name = sanitize_text_field($_POST['keep_in_touch_full_name']);
     97
     98        if (!isset($email_reference))
    9499            self::handle_subscribe_first_step($email);
    95         else if (sanitize_email($_POST['keep_in_touch_email_reference']) == $email)
    96             self::handle_subscribe_second_step($email);
     100        else if ($email_reference == $email)
     101            self::handle_subscribe_second_step($email, $full_name);
    97102        else
    98103            Keep_In_Touch_Msg::emit_invalid_anti_robot_check($email, $email_reference);
     
    104109    }
    105110
    106     static private function handle_subscribe_second_step($email)
     111    static private function handle_subscribe_second_step($email, $full_name)
    107112    {
    108113        $confirmation_code = Keep_In_Touch_Utils::generate_unique_id(20);
    109         if (Keep_In_Touch_Db::register_subscription_request($email, $confirmation_code))
     114        if (Keep_In_Touch_Db::register_subscription_request($email, $confirmation_code, $full_name))
    110115            Keep_In_Touch_Msg::emit_confirm_subscription($email, $confirmation_code);
    111116        else
Note: See TracChangeset for help on using the changeset viewer.