当前位置: 首页>>代码示例>>PHP>>正文


PHP RGFormsModel::save_lead方法代码示例

本文整理汇总了PHP中RGFormsModel::save_lead方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::save_lead方法的具体用法?PHP RGFormsModel::save_lead怎么用?PHP RGFormsModel::save_lead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RGFormsModel的用法示例。


在下文中一共展示了RGFormsModel::save_lead方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle_submission

 public static function handle_submission($form, &$lead, $ajax = false)
 {
     //creating entry in DB
     RGFormsModel::save_lead($form, $lead);
     //reading entry that was just saved
     $lead = RGFormsModel::get_lead($lead["id"]);
     $lead = GFFormsModel::set_entry_meta($lead, $form);
     do_action('gform_entry_created', $lead, $form);
     //if Akismet plugin is installed, run lead through Akismet and mark it as Spam when appropriate
     $is_spam = false;
     if (GFCommon::akismet_enabled($form['id']) && GFCommon::is_akismet_spam($form, $lead)) {
         $is_spam = true;
     }
     if (!$is_spam) {
         GFCommon::create_post($form, $lead);
         //send auto-responder and notification emails
         self::send_emails($form, $lead);
     } else {
         //marking entry as spam
         RGFormsModel::update_lead_property($lead["id"], "status", "spam", false, true);
         $lead["status"] = "spam";
     }
     //display confirmation message or redirect to confirmation page
     return self::handle_confirmation($form, $lead, $ajax);
 }
开发者ID:pwillems,项目名称:mimosa-contents,代码行数:25,代码来源:form_display.php

示例2: handle_submission

    public static function handle_submission($form, &$lead, $ajax=false){

        $lead_id = apply_filters("gform_entry_id_pre_save_lead{$form["id"]}", apply_filters("gform_entry_id_pre_save_lead", null, $form), $form);

        if(!empty($lead_id)){
            if(empty($lead))
                $lead = array();
            $lead["id"] = $lead_id;
        }

        //creating entry in DB
        RGFormsModel::save_lead($form, $lead);

        //reading entry that was just saved
        $lead = RGFormsModel::get_lead($lead["id"]);

		$lead = GFFormsModel::set_entry_meta($lead, $form);

        do_action('gform_entry_created', $lead, $form);
        $lead = apply_filters('gform_entry_post_save', $lead, $form);

        RGFormsModel::set_current_lead($lead);

        //if Akismet plugin is installed, run lead through Akismet and mark it as Spam when appropriate
        $is_spam = GFCommon::akismet_enabled($form['id']) && GFCommon::is_akismet_spam($form, $lead);

        GFCommon::log_debug("Checking for spam...");
        GFCommon::log_debug("Is entry considered spam? {$is_spam}.");

        if(!$is_spam){
            GFCommon::create_post($form, $lead);
            //send notifications
            GFCommon::send_form_submission_notifications($form, $lead);
        }
        else {
            //marking entry as spam
            RGFormsModel::update_lead_property($lead["id"], "status", "spam", false, true);
            $lead["status"] = "spam";
        }

        self::clean_up_files($form);

        //display confirmation message or redirect to confirmation page
        return self::handle_confirmation($form, $lead, $ajax);
    }
开发者ID:bmontague,项目名称:sct,代码行数:45,代码来源:form_display.php

示例3: handle_submission

 public static function handle_submission($form, &$lead, $ajax = false)
 {
     $lead_id = gf_apply_filters(array('gform_entry_id_pre_save_lead', $form['id']), null, $form);
     if (!empty($lead_id)) {
         if (empty($lead)) {
             $lead = array();
         }
         $lead['id'] = $lead_id;
     }
     //creating entry in DB
     RGFormsModel::save_lead($form, $lead);
     //reading entry that was just saved
     $lead = RGFormsModel::get_lead($lead['id']);
     $lead = GFFormsModel::set_entry_meta($lead, $form);
     //if Akismet plugin is installed, run lead through Akismet and mark it as Spam when appropriate
     $is_spam = GFCommon::akismet_enabled($form['id']) && GFCommon::is_akismet_spam($form, $lead);
     /**
      * A filter to set if an entry is spam
      *
      * @param int $form['id'] The Form ID to filter through (take directly from the form object)
      * @param bool $is_spam True or false to filter if the entry is spam
      * @param array $form The Form object to filer through
      * @param array $lead The Lead object to filter through
      */
     $is_spam = gf_apply_filters(array('gform_entry_is_spam', $form['id']), $is_spam, $form, $lead);
     if (GFCommon::spam_enabled($form['id'])) {
         GFCommon::log_debug('GFFormDisplay::handle_submission(): Akismet integration enabled OR gform_entry_is_spam hook in use.');
         $log_is_spam = $is_spam ? 'Yes' : 'No';
         GFCommon::log_debug("GFFormDisplay::handle_submission(): Is entry considered spam? {$log_is_spam}.");
     }
     if ($is_spam) {
         //marking entry as spam
         RGFormsModel::update_lead_property($lead['id'], 'status', 'spam', false, true);
         $lead['status'] = 'spam';
     }
     /**
      * Fired after an entry is created
      *
      * @param array $lead The Entry object
      * @param array $form The Form object
      */
     do_action('gform_entry_created', $lead, $form);
     $lead = gf_apply_filters(array('gform_entry_post_save', $form['id']), $lead, $form);
     RGFormsModel::set_current_lead($lead);
     if (!$is_spam) {
         GFCommon::create_post($form, $lead);
         //send notifications
         GFCommon::send_form_submission_notifications($form, $lead);
     }
     self::clean_up_files($form);
     // remove incomplete submission and purge expired
     if (rgars($form, 'save/enabled')) {
         GFFormsModel::delete_incomplete_submission(rgpost('gform_resume_token'));
         GFFormsModel::purge_expired_incomplete_submissions();
     }
     //display confirmation message or redirect to confirmation page
     return self::handle_confirmation($form, $lead, $ajax);
 }
开发者ID:timk85,项目名称:DIT,代码行数:58,代码来源:form_display.php

示例4: lead_detail_page

    public static function lead_detail_page()
    {
        global $wpdb;
        global $current_user;
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        echo GFCommon::get_remote_message();
        $form = RGFormsModel::get_form_meta($_GET["id"]);
        $lead = RGFormsModel::get_lead($_GET["lid"]);
        if (!$lead) {
            _e("OOps! We couldn't find your lead. Please try again", "gravityforms");
            return;
        }
        RGFormsModel::update_lead_property($lead["id"], "is_read", 1);
        $search_qs = empty($_GET["s"]) ? "" : "&s=" . $_GET["s"];
        $sort_qs = empty($_GET["sort"]) ? "" : "&sort=" . $_GET["sort"];
        $dir_qs = empty($_GET["dir"]) ? "" : "&dir=" . $_GET["dir"];
        $page_qs = empty($_GET["paged"]) ? "" : "&paged=" . absint($_GET["paged"]);
        switch (RGForms::post("action")) {
            case "update":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                RGFormsModel::save_lead($form, $lead);
                $lead = RGFormsModel::get_lead($_GET["lid"]);
                break;
            case "add_note":
                check_admin_referer('gforms_update_note', 'gforms_update_note');
                $user_data = get_userdata($current_user->ID);
                RGFormsModel::add_note($lead["id"], $current_user->ID, $user_data->display_name, stripslashes($_POST["new_note"]));
                //emailing notes if configured
                if (rgpost("gentry_email_notes_to")) {
                    $email_to = $_POST["gentry_email_notes_to"];
                    $email_from = $current_user->user_email;
                    $email_subject = stripslashes($_POST["gentry_email_subject"]);
                    $headers = "From: \"{$email_from}\" <{$email_from}> \r\n";
                    $result = wp_mail($email_to, $email_subject, stripslashes($_POST["new_note"]), $headers);
                }
                break;
            case "add_quick_note":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                $user_data = get_userdata($current_user->ID);
                RGFormsModel::add_note($lead["id"], $current_user->ID, $user_data->display_name, stripslashes($_POST["quick_note"]));
                break;
            case "bulk":
                check_admin_referer('gforms_update_note', 'gforms_update_note');
                if ($_POST["bulk_action"] == "delete") {
                    RGFormsModel::delete_notes($_POST["note"]);
                }
                break;
            case "delete":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                RGFormsModel::delete_lead($lead["id"]);
                ?>
                <div id="message" class="updated fade" style="background-color: rgb(255, 251, 204); margin-top:50px; padding:50px;">
                    <?php 
                _e("Entry has been deleted.", "gravityforms");
                ?>
 <a href="<?php 
                echo esc_url("admin.php?page=gf_entries&view=entries&id=" . absint($form["id"]) . $search_qs . $sort_qs . $dir_qs . $page_qs);
                ?>
"><?php 
                _e("Back to entries list", "gravityforms");
                ?>
</a>
                </div>
                <?php 
                exit;
                break;
        }
        $mode = empty($_POST["screen_mode"]) ? "view" : $_POST["screen_mode"];
        ?>
        <link rel="stylesheet" href="<?php 
        echo GFCommon::get_base_url();
        ?>
/css/admin.css" />
        <script type="text/javascript">

            function DeleteFile(leadId, fieldId){
                if(confirm(<?php 
        _e("'Would you like to delete this file? \\'Cancel\\' to stop. \\'OK\\' to delete'", "gravityforms");
        ?>
)){

                    var mysack = new sack("<?php 
        echo admin_url("admin-ajax.php");
        ?>
");
                    mysack.execute = 1;
                    mysack.method = 'POST';
                    mysack.setVar( "action", "rg_delete_file" );
                    mysack.setVar( "rg_delete_file", "<?php 
        echo wp_create_nonce("rg_delete_file");
        ?>
" );
                    mysack.setVar( "lead_id", leadId );
                    mysack.setVar( "field_id", fieldId );
                    mysack.encVar( "cookie", document.cookie, false );
                    mysack.onError = function() { alert('<?php 
        echo esc_js(__("Ajax error while deleting field.", "gravityforms"));
        ?>
//.........这里部分代码省略.........
开发者ID:hypenotic,项目名称:slowfood,代码行数:101,代码来源:entry_detail.php

示例5: lead_detail_page

    public static function lead_detail_page()
    {
        global $wpdb;
        global $current_user;
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        echo GFCommon::get_remote_message();
        $form = RGFormsModel::get_form_meta($_GET["id"]);
        $form = apply_filters("gform_admin_pre_render_" . $form["id"], apply_filters("gform_admin_pre_render", $form));
        $lead_id = rgget('lid');
        $filter = rgget("filter");
        $status = in_array($filter, array("trash", "spam")) ? $filter : "active";
        $search = rgget("s");
        $position = rgget('pos') ? rgget('pos') : 0;
        $sort_direction = rgget('dir') ? rgget('dir') : 'DESC';
        $sort_field = empty($_GET["sort"]) ? 0 : $_GET["sort"];
        $sort_field_meta = RGFormsModel::get_field($form, $sort_field);
        $is_numeric = $sort_field_meta["type"] == "number";
        $star = $filter == "star" ? 1 : null;
        $read = $filter == "unread" ? 0 : null;
        // added status as an optional parameter to get_lead_count because the counts are inaccurate without using the status
        $lead_count = RGFormsModel::get_lead_count($form['id'], $search, $star, $read, null, null, $status);
        $prev_pos = !rgblank($position) && $position > 0 ? $position - 1 : false;
        $next_pos = !rgblank($position) && $position < $lead_count - 1 ? $position + 1 : false;
        // unread filter requires special handling for pagination since entries are filter out of the query as they are read
        if ($filter == 'unread') {
            $next_pos = $position;
            if ($next_pos + 1 == $lead_count) {
                $next_pos = false;
            }
        }
        // get the lead
        $leads = RGFormsModel::get_leads($form['id'], $sort_field, $sort_direction, $search, $position, 1, $star, $read, $is_numeric, null, null, $status);
        if (!$lead_id) {
            $lead = !empty($leads) ? $leads[0] : false;
        } else {
            $lead = RGFormsModel::get_lead($lead_id);
        }
        if (!$lead) {
            _e("Oops! We couldn't find your lead. Please try again", "gravityforms");
            return;
        }
        RGFormsModel::update_lead_property($lead["id"], "is_read", 1);
        switch (RGForms::post("action")) {
            case "update":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                RGFormsModel::save_lead($form, $lead);
                do_action("gform_after_update_entry", $form, $lead["id"]);
                do_action("gform_after_update_entry_{$form["id"]}", $form, $lead["id"]);
                $lead = RGFormsModel::get_lead($lead["id"]);
                $lead = GFFormsModel::set_entry_meta($lead, $form);
                break;
            case "add_note":
                check_admin_referer('gforms_update_note', 'gforms_update_note');
                $user_data = get_userdata($current_user->ID);
                RGFormsModel::add_note($lead["id"], $current_user->ID, $user_data->display_name, stripslashes($_POST["new_note"]));
                //emailing notes if configured
                if (rgpost("gentry_email_notes_to")) {
                    $email_to = $_POST["gentry_email_notes_to"];
                    $email_from = $current_user->user_email;
                    $email_subject = stripslashes($_POST["gentry_email_subject"]);
                    $headers = "From: \"{$email_from}\" <{$email_from}> \r\n";
                    $result = wp_mail($email_to, $email_subject, stripslashes($_POST["new_note"]), $headers);
                }
                break;
            case "add_quick_note":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                $user_data = get_userdata($current_user->ID);
                RGFormsModel::add_note($lead["id"], $current_user->ID, $user_data->display_name, stripslashes($_POST["quick_note"]));
                break;
            case "bulk":
                check_admin_referer('gforms_update_note', 'gforms_update_note');
                if ($_POST["bulk_action"] == "delete") {
                    RGFormsModel::delete_notes($_POST["note"]);
                }
                break;
            case "trash":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                RGFormsModel::update_lead_property($lead["id"], "status", "trash");
                $lead = RGFormsModel::get_lead($lead["id"]);
                break;
            case "restore":
            case "unspam":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                RGFormsModel::update_lead_property($lead["id"], "status", "active");
                $lead = RGFormsModel::get_lead($lead["id"]);
                break;
            case "spam":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                RGFormsModel::update_lead_property($lead["id"], "status", "spam");
                $lead = RGFormsModel::get_lead($lead["id"]);
                break;
            case "delete":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                RGFormsModel::delete_lead($lead["id"]);
                ?>
                <script type="text/javascript">
                    document.location.href='<?php 
                echo "admin.php?page=gf_entries&view=entries&id=" . absint($form["id"]);
//.........这里部分代码省略.........
开发者ID:nikibrown,项目名称:2014-Nerd-presentation,代码行数:101,代码来源:entry_detail.php

示例6: handle_submission

 public static function handle_submission($form, &$lead, $ajax = false)
 {
     //insert submissing in DB
     RGFormsModel::save_lead($form, $lead);
     //reading lead that was just saved
     $lead = RGFormsModel::get_lead($lead["id"]);
     $disable_post = apply_filters("gform_disable_post_creation_{$form["id"]}", apply_filters("gform_disable_post_creation", false, $form, $lead), $form, $lead);
     if (!$disable_post) {
         //creates post if the form has any post fields
         $post_id = RGFormsModel::create_post($form, $lead);
     }
     //send auto-responder and notification emails
     self::send_emails($form, $lead);
     //display confirmation message or redirect to confirmation page
     return self::handle_confirmation($form, $lead, $ajax);
 }
开发者ID:hypenotic,项目名称:slowfood,代码行数:16,代码来源:form_display.php

示例7: test_email_notification_groups

 /** Group notifications */
 public function test_email_notification_groups()
 {
     wp_set_current_user(1);
     /* Activate digests for a form */
     $_POST['form_notification_enable_digest'] = true;
     $_POST['save'] = true;
     $_GET['id'] = '1';
     $_POST['form_notification_digest_screen'] = true;
     $_POST['form_notification_enable_digest'] = true;
     $_POST['form_notification_digest_emails'] = 'testing@digests.lo, testing2@digests.lo';
     $_POST['form_notification_digest_interval'] = 'minute';
     $_POST['form_notification_digest_group'] = 'sales';
     $_POST['form_notification_digest_export_fields'] = 'all';
     $this->digest->init();
     // TODO: A better way to add
     /* Activate digests for a form */
     $_POST['form_notification_enable_digest'] = true;
     $_POST['save'] = true;
     $_GET['id'] = '2';
     $_POST['form_notification_digest_screen'] = true;
     $_POST['form_notification_enable_digest'] = true;
     $_POST['form_notification_digest_emails'] = 'testing@digests.lo, testing2@digests.lo, out@digests.lo';
     $_POST['form_notification_digest_interval'] = 'minute';
     $_POST['form_notification_digest_group'] = 'sales';
     $_POST['form_notification_digest_export_fields'] = 'all';
     $this->digest->init();
     // TODO: A better way to add
     $_POST[] = array();
     $_GET[] = array();
     $null = null;
     $_POST['input_1'] = 'One';
     $_POST['input_2'] = array('two', 'three');
     RGFormsModel::save_lead(RGFormsModel::get_form_meta(1), $null);
     $_POST[] = array();
     $_GET[] = array();
     $null = null;
     $_POST['input_1'] = 'Gary';
     $_POST['input_2'] = 'yesterday';
     RGFormsModel::save_lead(RGFormsModel::get_form_meta(2), $null);
     $_POST[] = array();
     $_GET[] = array();
     $null = null;
     $_POST['input_1'] = 'Larry';
     $_POST['input_2'] = 'tomorrow';
     RGFormsModel::save_lead(RGFormsModel::get_form_meta(2), $null);
     /* Test the correct cron call */
     do_action_ref_array('gf_digest_send_notifications', array(1));
     $form = RGFormsModel::get_form_meta(1);
     $this->assertEquals($form['digests']['digest_last_sent'], 1);
     $form = RGFormsModel::get_form_meta(2);
     $this->assertEquals($form['digests']['digest_last_sent'], 3);
     global $phpmailer;
     $this->assertNotEmpty($phpmailer->mock_sent);
     $this->assertEquals(count($phpmailer->mock_sent), 3);
     /* Let's take a look here... (should be in a test of its own) */
     preg_match('#filename="?(.*\\.csv)"?#', $phpmailer->mock_sent[0]['body'], $matches);
     $filename = sys_get_temp_dir() . '/' . $matches[1];
     $csv = fopen($filename, 'rb');
     $this->assertEquals(fgetcsv($csv), array('Form: Test Form (#1)'));
     fgetcsv($csv);
     fgetcsv($csv);
     fgetcsv($csv);
     $this->assertEquals(fgetcsv($csv), array('Form: Help (#2)'));
     fclose($csv);
     unlink($filename);
 }
开发者ID:acesmf,项目名称:Gravity-Forms-Digest-Bulk-Reports,代码行数:67,代码来源:main.php

示例8: edit_lead_detail

    public function edit_lead_detail($Form, $lead, $options)
    {
        global $current_user, $_gform_directory_approvedcolumn;
        if (empty($_gform_directory_approvedcolumn)) {
            $_gform_directory_approvedcolumn = self::get_approved_column($Form);
        }
        $adminonlycolumns = self::get_admin_only($Form);
        // If you want to allow users to edit their own approval (?) add a filter and return true.
        if (apply_filters('kws_gf_directory_allow_user_edit_approved', false) === false) {
            $Form['fields'] = self::remove_approved_column('form', $Form['fields'], $_gform_directory_approvedcolumn);
        }
        if (isset($_GET['edit']) && !wp_verify_nonce(RGForms::get('edit'), 'edit')) {
            _e(sprintf('%sYou do not have permission to edit this form.%s', '<div class="error">', '</div>'), 'gravity-forms-addons');
            return;
        }
        if ((!empty($options['useredit']) && is_user_logged_in() && $current_user->id === $lead['created_by']) === true || (!empty($options['adminedit']) && self::has_access("gravityforms_directory")) === true) {
            if (RGForms::post("action") === "update") {
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                $lead = apply_filters('kws_gf_directory_lead_being_updated', $lead, $Form);
                do_action('kws_gf_directory_pre_update_lead', $lead, $Form);
                RGFormsModel::save_lead($Form, $lead);
                $lead = RGFormsModel::get_lead($lead["id"]);
                do_action('kws_gf_directory_post_update_lead', $lead, $Form);
                _e(apply_filters('kws_gf_directory_lead_updated_message', sprintf("%sThe entry was successfully updated.%s", "<p class='updated' id='message' style='padding:.5em .75em; background-color:#ffffcc; border:1px solid #ccc;'>", "</p>"), $lead, $Form), 'gravity-forms-addons');
            } elseif (isset($_GET['edit'])) {
                add_filter('kws_gf_directory_backlink', array('GFDirectory', 'edit_entry_backlink'), 1, 2);
                ?>
				<form method="post" id="entry_form" enctype="multipart/form-data" action="<?php 
                echo remove_query_arg(array('gf_search', 'sort', 'dir', 'page', 'edit'), add_query_arg(array()));
                ?>
">
		            <?php 
                wp_nonce_field('gforms_save_entry', 'gforms_save_entry');
                ?>
		            <input type="hidden" name="action" id="action" value="update"/>
		            <input type="hidden" name="screen_mode" id="screen_mode" value="edit" />
		            <?php 
                self::lead_detail_edit($Form, $lead);
                _e('<input class="button-primary" type="submit" tabindex="4" value="' . apply_filters('kws_gf_directory_update_lead_button_text', __('Update Entry', 'gravity-forms-addons')) . '" name="save" />');
                ?>
				</form>
				<?php 
                return false;
            }
        }
        return $lead;
    }
开发者ID:rongandat,项目名称:cyarevfoods,代码行数:47,代码来源:gravity-forms-addons.php

示例9: handle_submission

 public static function handle_submission($form, &$lead)
 {
     //insert submissing in DB
     RGFormsModel::save_lead($form, $lead);
     //reading lead that was just saved
     $lead = RGFormsModel::get_lead($lead["id"]);
     //send auto-responder and notification emails
     self::send_emails($form, $lead);
     //display confirmation message or redirect to confirmation page
     return self::handle_confirmation($form, $lead);
 }
开发者ID:812studio,项目名称:812studio,代码行数:11,代码来源:form_display.php

示例10: get_form_values

 /**
  * Retrieve the lead values
  */
 function get_form_values($form_id, $lead_id)
 {
     //echo "get form values form id = $form_id - lead id = $lead_id <br>";
     if (!$lead_id) {
         return false;
     }
     if (!$form_id) {
         return false;
     }
     global $wpdb;
     $ret = false;
     $form = RGFormsModel::get_form_meta($form_id);
     $lead_table_name = RGFormsModel::get_lead_table_name();
     //echo " form $form <br> lead table $lead_table_name <br>";
     /**
      * Support for Sp-Gf-MySQL-Connect
      * If we only have a MySQL-Record and no lead
      * we have to create a dummy lead to make this work
      */
     if ($form['spgfmc_tablename'] && $form['spgfmc_deletelead']) {
         $primarykey = $lead_id;
         /**
          * Now we are going to create a dummy lead
          * This is very bad :-( but it works :-)
          */
         $lead_id = -1;
         $lead = NULL;
         RGFormsModel::save_lead($form, $lead);
     }
     /**
      * Only get the last saved lead for this form
      */
     if ($lead_id == -1) {
         $lead_id = $wpdb->get_var($wpdb->prepare("SELECT DISTINCT id FROM {$lead_table_name} WHERE form_id = %d AND created_by = %d AND status = 'active' ORDER BY id DESC LIMIT 1", $form_id, wp_get_current_user()->ID));
     }
     /**
      * If we have a lead id, we can continue
      */
     if ($lead_id) {
         $lead = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$lead_table_name} WHERE form_id = %d AND id = %d", $form['id'], $lead_id), ARRAY_A);
         /**
          * Support for Sp-Gf-MySQL-Connect
          * If we connected the record to a mysql-table and set 'delete data' to true
          * we have to retrieve the values from the mysql-table
          */
         if ($form['spgfmc_tablename'] && $form['spgfmc_deletefield']) {
             $wpdb->show_errors();
             if (!$form['spgfmc_deletelead']) {
                 /**
                  * If the lead was not deleted we use the 'lead_id' to
                  * connect the MySQL record with the GF lead
                  */
                 $data = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$form['spgfmc_tablename']} WHERE {$form['spgfmc_field_leadid']} = %s", $lead_id), ARRAY_A);
             } elseif ($form['spgfmc_deletelead']) {
                 /**
                  * If the lead was deleted we use the already loaded data
                  * But we have to setup some lead values
                  */
                 $data = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$form['spgfmc_tablename']} WHERE {$form['spgfmc_field_leadid']} = %d", $primarykey), ARRAY_A);
             } else {
                 /**
                  * We can't load any data
                  */
                 unset($data);
             }
             if ($data) {
                 foreach ((array) $form['fields'] as $field) {
                     switch ($field['type']) {
                         case 'address':
                             if ($field['spgfmc_fieldname_address1']) {
                                 $lead[$field['id'] . '.1'] = $data[$field['spgfmc_fieldname_address1']];
                             }
                             if ($field['spgfmc_fieldname_address1']) {
                                 $lead[$field['id'] . '.2'] = $data[$field['spgfmc_fieldname_address2']];
                             }
                             if ($field['spgfmc_fieldname_city']) {
                                 $lead[$field['id'] . '.3'] = $data[$field['spgfmc_fieldname_city']];
                             }
                             if ($field['spgfmc_fieldname_state']) {
                                 $lead[$field['id'] . '.4'] = $data[$field['spgfmc_fieldname_state']];
                             }
                             if ($field['spgfmc_fieldname_zip']) {
                                 $lead[$field['id'] . '.5'] = $data[$field['spgfmc_fieldname_zip']];
                             }
                             if ($field['spgfmc_fieldname_country']) {
                                 $lead[$field['id'] . '.6'] = $data[$field['spgfmc_fieldname_country']];
                             }
                             break;
                         case 'name':
                             if ($field['spgfmc_fieldname_firstname']) {
                                 $lead[$field['id'] . '.3'] = $data[$field['spgfmc_fieldname_firstname']];
                             }
                             if ($field['spgfmc_fieldname_lastname']) {
                                 $lead[$field['id'] . '.6'] = $data[$field['spgfmc_fieldname_lastname']];
                             }
                         default:
                             if ($field['spgfmc_fieldname']) {
//.........这里部分代码省略.........
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:101,代码来源:sp-gf-list-edit.php


注:本文中的RGFormsModel::save_lead方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。