本文整理汇总了PHP中RGFormsModel::get_lead_details_table_name方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::get_lead_details_table_name方法的具体用法?PHP RGFormsModel::get_lead_details_table_name怎么用?PHP RGFormsModel::get_lead_details_table_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::get_lead_details_table_name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_makerfaire_status_counts
function get_makerfaire_status_counts($form_id)
{
global $wpdb;
$lead_details_table_name = RGFormsModel::get_lead_details_table_name();
$sql = $wpdb->prepare("SELECT count(0) as entries,value as label FROM {$lead_details_table_name}\n\t\t\t join wp_rg_lead lead \n on lead.id = {$lead_details_table_name}.lead_id and \n lead.status = 'active'\n where field_number='303'\n\t\t\tand {$lead_details_table_name}.form_id=%d\n\t\t\tgroup by value", $form_id);
$results = $wpdb->get_results($sql, ARRAY_A);
return $results;
}
示例2: fix_checkbox_value
private static function fix_checkbox_value()
{
global $wpdb;
$table_name = RGFormsModel::get_lead_details_table_name();
$sql = "select * from {$table_name} where value= '!'";
$results = $wpdb->get_results($sql);
foreach ($results as $result) {
$form = RGFormsModel::get_form_meta($result->form_id);
$field = RGFormsModel::get_field($form, $result->field_number);
if ($field->type == 'checkbox') {
$input = GFCommon::get_input($field, $result->field_number);
$wpdb->update($table_name, array('value' => $input['label']), array('id' => $result->id));
}
}
}
示例3: delete_signature
public function delete_signature($lead_id, $field_id)
{
global $wpdb;
$lead = RGFormsModel::get_lead($lead_id);
$this->delete_signature_file(rgar($lead, $field_id));
$lead_detail_table = RGFormsModel::get_lead_details_table_name();
$sql = $wpdb->prepare("UPDATE {$lead_detail_table} SET value = '' WHERE lead_id=%d AND field_number BETWEEN %s AND %s", $lead_id, doubleval($field_id) - 0.001, doubleval($field_id) + 0.001);
return $wpdb->query($sql);
}
示例4: get_lead_detail_long_value
/**
* get_lead_detail_long_value
*
* Helper to get the 'long value' for a specific entry field
*
* @param int $lead_id Entry ID
* @param int $field_id Field ID
* @return string $results Value from 'long value' gforms table
* @access public
* @author Ben Moody
*/
private function get_lead_detail_long_value($lead_id = NULL, $field_id = NULL)
{
//Init vars
global $wpdb;
$lead_detail_id = NULL;
$results = NULL;
if (isset($lead_id, $field_id)) {
$lead_details_table_name = RGFormsModel::get_lead_details_table_name();
$lead_details_long_table_name = RGFormsModel::get_lead_details_long_table_name();
$lead_detail_id = $wpdb->get_results("SELECT lead_detail_id FROM {$lead_details_table_name} d\n\t \t INNER JOIN {$lead_details_long_table_name} l ON d.id = l.lead_detail_id\n\t \t WHERE lead_id = {$lead_id} AND field_number = {$field_id}");
if (isset($lead_detail_id[0]->lead_detail_id)) {
$lead_detail_id = $lead_detail_id[0]->lead_detail_id;
$results = $wpdb->get_results("SELECT {$lead_details_long_table_name}.value FROM {$lead_details_long_table_name}\n\t\t \t WHERE lead_detail_id = {$lead_detail_id}");
}
if (isset($results[0]->value)) {
$results = maybe_unserialize($results[0]->value);
}
}
return $results;
}
示例5: detachFormEntry
public function detachFormEntry($lead_id)
{
$entries = $this->getFormEntryIds();
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Start to detach gravity forms: " . print_r($entries, true));
if (in_array($lead_id, $entries)) {
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Lead id is in the list of entries: " . $lead_id);
if (class_exists('RGForms')) {
if (!class_exists('RGFormsModel')) {
RGForms::init();
}
if (class_exists('RGFormsModel')) {
global $wpdb;
$lead_table = RGFormsModel::get_lead_table_name();
$lead_notes_table = RGFormsModel::get_lead_notes_table_name();
$lead_detail_table = RGFormsModel::get_lead_details_table_name();
$lead_detail_long_table = RGFormsModel::get_lead_details_long_table_name();
//Delete from detail long
$sql = $wpdb->prepare(" DELETE FROM {$lead_detail_long_table}\n WHERE lead_detail_id IN(\n SELECT id FROM {$lead_detail_table} WHERE lead_id=%d\n )", $lead_id);
$wpdb->query($sql);
//Delete from lead details
$sql = $wpdb->prepare("DELETE FROM {$lead_detail_table} WHERE lead_id=%d", $lead_id);
$wpdb->query($sql);
//Delete from lead notes
$sql = $wpdb->prepare("DELETE FROM {$lead_notes_table} WHERE lead_id=%d", $lead_id);
$wpdb->query($sql);
//Delete from lead
$sql = $wpdb->prepare("DELETE FROM {$lead_table} WHERE id=%d", $lead_id);
$wpdb->query($sql);
// Remove entry from array
$entries = array_values(array_diff($entries, array($lead_id)));
$this->_formEntryIds = $entries;
$qty = $this->getQuantity();
$this->setQuantity($qty - 1);
}
}
}
}
示例6: rtlib_defined_map_field_value
/**
* define map field value
*
* @since
*/
public function rtlib_defined_map_field_value()
{
$form_id = $_REQUEST['map_form_id'];
if (isset($_REQUEST['mapSourceType']) && 'gravity' == $_REQUEST['mapSourceType']) {
$field_id = intval($_REQUEST['field_id']);
$tableName = RGFormsModel::get_lead_details_table_name();
global $wpdb;
$result = $wpdb->get_results($wpdb->prepare("select distinct value from {$tableName} where form_id= %d and field_number = %d ", $form_id, $field_id));
} else {
$field_id = $_REQUEST['field_id'];
$csv = new parseCSV();
$csv->auto($form_id);
$result = array();
$field_id = str_replace('-s-', ' ', $field_id);
foreach ($csv->data as $cdt) {
$tmpArr = array('value' => $cdt[$field_id]);
if (!in_array($tmpArr, $result)) {
$result[] = $tmpArr;
}
if (count($result) > 15) {
break;
}
}
}
header('Content-Type: application/json');
if (count($result) < 15) {
echo json_encode($result);
} else {
echo json_encode(array());
}
die(0);
}
示例7: update_gforms_entry_meta
/**
* update_gforms_entry_meta
*
* Updates form entry data to show api video uploads in entries view
*
* @access private
* @author Ben Moody
*/
private function update_gforms_entry_meta($field_values = array())
{
//Init vars
global $wpdb;
$lead_details_table_name = NULL;
$lead_details_long_table_name = NULL;
$entry_id = NULL;
$results = NULL;
if (!empty($field_values) && isset($this->data['gforms_entry']['id'])) {
//Cache entry data provided from gravity forms
$entry_id = $this->data['gforms_entry']['id'];
//Allow devs to hook before we get the gravity form table names ect
do_action('prso_gform_youtube_uploader_pre_update_meta', $field_values, $this->data);
//Get gravity forms table names
$lead_details_table_name = RGFormsModel::get_lead_details_table_name();
$lead_details_long_table_name = RGFormsModel::get_lead_details_long_table_name();
//Loop the array of field values and update the gravity forms meta for each field
foreach ($field_values as $field_id => $value) {
//Get the lead detail id required to find the our value in gforms meta table
$results = $wpdb->get_results("SELECT lead_detail_id FROM {$lead_details_table_name} d\n\t\t \t INNER JOIN {$lead_details_long_table_name} l ON d.id = l.lead_detail_id\n\t\t \t WHERE lead_id = {$entry_id} AND field_number = {$field_id}");
//Update the gforms meta values with our new data including the video api data
if (isset($results[0]->lead_detail_id)) {
//Update upload details
//Serialize array
$value = maybe_serialize($value);
//As gforms only looks at details long table if value maxs out the std table
//Update std table before long table - value will be truncated by mysql
//No probs as it will be stored ok in long table next
$wpdb->query($wpdb->prepare("UPDATE {$lead_details_table_name} SET value = %s \n\t\t\t \t\t WHERE id = %d", $value, $results[0]->lead_detail_id));
$wpdb->query($wpdb->prepare("UPDATE {$lead_details_long_table_name} SET value = %s \n\t\t\t \t\t WHERE lead_detail_id = %d", $value, $results[0]->lead_detail_id));
}
}
}
}
开发者ID:QuackenbushDev,项目名称:prso-gravity-forms-adv-uploader,代码行数:42,代码来源:class.prso-adv-s3-uploader.php
示例8: gform_post_submission
public function gform_post_submission($entry, $form)
{
global $wpdb;
$this->options['entries'] = apply_filters($this->name . '_entries', $this->options['entries'], $form);
if (!$this->options['entries'] || $this->is_delete()) {
$tables = (object) array('lead_table' => RGFormsModel::get_lead_table_name(), 'lead_notes_table' => RGFormsModel::get_lead_notes_table_name(), 'lead_detail_table' => RGFormsModel::get_lead_details_table_name(), 'lead_detail_long_table' => RGFormsModel::get_lead_details_long_table_name());
$queries = array($wpdb->prepare("DELETE FROM {$tables->lead_detail_long_table} WHERE lead_detail_id IN (SELECT id FROM {$tables->lead_detail_table} WHERE lead_id = %d)", $entry['id']), $wpdb->prepare("DELETE FROM {$tables->lead_detail_table} WHERE lead_id = %d", $entry['id']), $wpdb->prepare("DELETE FROM {$tables->lead_notes_table} WHERE lead_id = %d", $entry['id']), $wpdb->prepare("DELETE FROM {$tables->lead_table} WHERE id = %d", $entry['id']));
foreach ($queries as $query) {
$wpdb->query($query);
}
}
if ($this->is_delete()) {
wp_delete_post($this->post['ID']);
}
// If a custom field is unique, get all the rows and combine them into one
foreach ($form['fields'] as $field) {
if ($field['type'] == 'post_custom_field' && isset($field['postCustomFieldUnique'])) {
$meta = get_post_meta($this->post['ID'], $field['postCustomFieldName']);
delete_post_meta($this->post['ID'], $field['postCustomFieldName']);
add_post_meta($this->post['ID'], $field['postCustomFieldName'], is_array($meta) && count($meta) == 1 ? $meta[0] : $meta, true);
}
}
}
示例9: save_lead
/**
* Adapted from forms_model.php, RGFormsModel::save_lead($Form, $lead)
* @param array $form Form object.
* @param array $lead Lead object
* @return void
*/
public static function save_lead($form, &$lead)
{
global $wpdb;
if (IS_ADMIN && !GFCommon::current_user_can_any("gravityforms_edit_entries")) {
die(__("You don't have adequate permission to edit entries.", "gravityforms"));
}
$lead_detail_table = RGFormsModel::get_lead_details_table_name();
//Inserting lead if null
if ($lead == null) {
global $current_user;
$user_id = $current_user && $current_user->ID ? $current_user->ID : 'NULL';
$lead_table = RGFormsModel::get_lead_table_name();
$user_agent = RGFormsModel::truncate($_SERVER["HTTP_USER_AGENT"], 250);
$currency = GFCommon::get_currency();
$source_url = RGFormsModel::truncate(RGFormsModel::get_current_page_url(), 200);
$wpdb->query($wpdb->prepare("INSERT INTO {$lead_table}(form_id, ip, source_url, date_created, user_agent, currency, created_by) VALUES(%d, %s, %s, utc_timestamp(), %s, %s, {$user_id})", $form["id"], RGFormsModel::get_ip(), $source_url, $user_agent, $currency));
//reading newly created lead id
$lead_id = $wpdb->insert_id;
$lead = array("id" => $lead_id);
}
$current_fields = $wpdb->get_results($wpdb->prepare("SELECT id, field_number FROM {$lead_detail_table} WHERE lead_id=%d", $lead["id"]));
$original_post_id = rgget("post_id", $lead);
$total_fields = array();
$calculation_fields = array();
$recalculate_total = false;
foreach ($form["fields"] as $field) {
//Ignore fields that are marked as display only
if (rgget("displayOnly", $field) && $field["type"] != "password") {
continue;
}
//ignore pricing fields in the entry detail
if (RG_CURRENT_VIEW == "entry" && GFCommon::is_pricing_field($field["type"])) {
continue;
}
//process total field after all fields have been saved
if ($field["type"] == "total") {
$total_fields[] = $field;
continue;
}
//only save fields that are not hidden (except on entry screen)
if (RG_CURRENT_VIEW == "entry" || !RGFormsModel::is_field_hidden($form, $field, array(), $lead)) {
// process calculation fields after all fields have been saved (moved after the is hidden check)
if (GFCommon::has_field_calculation($field)) {
$calculation_fields[] = $field;
continue;
}
if ($field['type'] == 'post_category') {
$field = GFCommon::add_categories_as_choices($field, '');
}
if (isset($field["inputs"]) && is_array($field["inputs"])) {
foreach ($field["inputs"] as $input) {
RGFormsModel::save_input($form, $field, $lead, $current_fields, $input["id"]);
}
} else {
RGFormsModel::save_input($form, $field, $lead, $current_fields, $field["id"]);
}
}
//Refresh lead to support conditionals (not optimal but...)
$lead = RGFormsModel::get_lead($lead['id']);
}
if (!empty($calculation_fields)) {
foreach ($calculation_fields as $calculation_field) {
if (isset($calculation_field["inputs"]) && is_array($calculation_field["inputs"])) {
foreach ($calculation_field["inputs"] as $input) {
RGFormsModel::save_input($form, $calculation_field, $lead, $current_fields, $input["id"]);
RGFormsModel::refresh_lead_field_value($lead["id"], $input["id"]);
}
} else {
RGFormsModel::save_input($form, $calculation_field, $lead, $current_fields, $calculation_field["id"]);
RGFormsModel::refresh_lead_field_value($lead["id"], $calculation_field["id"]);
}
}
RGFormsModel::refresh_product_cache($form, $lead = RGFormsModel::get_lead($lead['id']));
}
//saving total field as the last field of the form.
if (!empty($total_fields)) {
foreach ($total_fields as $total_field) {
GFCommon::log_debug("Saving total field.");
RGFormsModel::save_input($form, $total_field, $lead, $current_fields, $total_field["id"]);
}
}
}
示例10: get_lead_count
function get_lead_count($form_id, $search, $star = null, $read = null, $column, $approved = false, $leads = array(), $start_date = null, $end_date = null, $limituser = false)
{
global $wpdb, $current_user;
if (!is_numeric($form_id)) {
return "";
}
$detail_table_name = RGFormsModel::get_lead_details_table_name();
$lead_table_name = RGFormsModel::get_lead_table_name();
$star_filter = $star !== null ? $wpdb->prepare("AND is_starred=%d ", $star) : "";
$read_filter = $read !== null ? $wpdb->prepare("AND is_read=%d ", $read) : "";
if (function_exists('gform_get_meta')) {
$status_filter = $wpdb->prepare(" AND status=%s ", 'active');
} else {
$status_filter = '';
}
$start_date_filter = empty($start_date) ? "" : " AND datediff(date_created, '{$start_date}') >=0";
$end_date_filter = empty($end_date) ? "" : " AND datediff(date_created, '{$end_date}') <=0";
$search_term = "%{$search}%";
$search_filter = empty($search) ? "" : $wpdb->prepare("AND ld.value LIKE %s", $search_term);
$user_filter = '';
if ($limituser) {
get_currentuserinfo();
if ((int) $current_user->ID !== 0 || $current_user->ID === 0 && apply_filters('kws_gf_show_entries_if_not_logged_in', apply_filters('kws_gf_treat_not_logged_in_as_user', true))) {
if (!empty($current_user->ID)) {
$user_filter = $wpdb->prepare(" AND l.created_by=%d ", $current_user->ID);
} else {
$user_filter = $wpdb->prepare(" AND (created_by IS NULL OR created_by=%d)", $current_user->ID);
}
} else {
return false;
}
}
$in_filter = "";
if ($approved) {
$in_filter = $wpdb->prepare("l.id IN (SELECT lead_id from {$detail_table_name} WHERE field_number BETWEEN %f AND %f) AND", $column - 0.001, $column + 0.001);
// This will work once all the fields are converted to the meta_key after 1.6
#$search_filter .= $wpdb->prepare(" AND m.meta_key = 'is_approved' AND m.meta_value = %s", 1);
}
$sql = "SELECT count(distinct l.id) FROM {$lead_table_name} as l,\n\t\t\t\t{$detail_table_name} as ld";
# $sql .= function_exists('gform_get_meta') ? " INNER JOIN wp_rg_lead_meta m ON l.id = m.lead_id " : ""; // After 1.6
$sql .= "\n\t\t\t\tWHERE {$in_filter}\n\t\t\t\tl.form_id={$form_id}\n\t\t\t\tAND ld.form_id={$form_id}\n\t\t\t\tAND l.id = ld.lead_id\n\t\t\t\t{$star_filter}\n\t\t\t\t{$read_filter}\n\t\t\t\t{$status_filter}\n\t\t\t\t{$user_filter}\n\t\t\t\t{$start_date_filter}\n\t\t\t\t{$end_date_filter}\n\t\t\t\t{$search_filter}";
return $wpdb->get_var($sql);
}
示例11: process_attachments
function process_attachments($entry, $form)
{
$upload_field_ids = array();
foreach ($form['fields'] as $form_field) {
if ($form_field->type == 'fileupload') {
array_push($upload_field_ids, $form_field->id);
}
}
//loop through upload field IDS and push contents to S3
foreach ($upload_field_ids as $upload_field_id) {
if (!empty($entry[$upload_field_id])) {
// Grab the field value
$field_value = $entry[$upload_field_id];
// If multi-uplaod is enabled for the field, the value will be a JSON string.
// Decode it so we can test if it's an array
$field_value_decoded = json_decode($field_value);
// If we have an aray, loop through it and upload each file
// Else, just uplaod the one file.
if (is_array($field_value_decoded)) {
// empty array to store new urls
$new_file_url = array();
foreach ($field_value_decoded as $attachment_url) {
//push file to S3 and return new url
$multi_file_item_url = upload_to_s3($attachment_url, $form['id']);
//push new url in the new url array
array_push($new_file_url, $multi_file_item_url);
}
//json encode the new url before updating DB
$new_file_url = json_encode($new_file_url);
} else {
$new_file_url = upload_to_s3($field_value, $form['id']);
}
//gform_update_meta( $entry['id'], 'api_response', $new_file_url );
global $wpdb;
$lead_detail_table = RGFormsModel::get_lead_details_table_name();
if (is_array($field_value_decoded)) {
$entry_detail_row = $wpdb->get_row("SELECT * FROM {$lead_detail_table} WHERE field_number = {$upload_field_id} AND lead_id = {$entry['id']} AND form_id = {$entry['form_id']}", ARRAY_A);
$entry_detail_id = $entry_detail_row["id"];
$lead_detail_long_table = RGFormsModel::get_lead_details_long_table_name();
$wpdb->update($lead_detail_long_table, array('value' => $new_file_url), array('lead_detail_id' => $entry_detail_id));
} else {
$wpdb->update($lead_detail_table, array('value' => $new_file_url), array('field_number' => $upload_field_id, 'lead_id' => $entry['id'], 'form_id' => $entry['form_id']));
}
}
}
}
示例12: gform_entry_created
/**
* Save payment information to DB
*
* @since 1.7.9.1
*
* @uses rgar()
* @uses GFCommon::get_currency()
* @uses rgpost()
* @uses RGFormsModel::get_lead_details_table_name()
* @uses wpdb->prepare()
* @uses wpdb->get_results()
* @uses RGFormsModel::get_lead_detail_id()
* @uses wpdb->update()
* @uses wpdb->insert()
* @uses RGFormsModel::update_lead()
* @uses apply_filters()
* @uses GFP_Stripe::get_feed()
* @uses gform_update_meta()
* @uses GFP_Stripe_Data::insert_transaction()
*
* @param $entry
* @param $form
*
* @return void
*/
public function gform_entry_created($entry, $form)
{
global $wpdb;
$entry_id = rgar($entry, 'id');
if (!empty(self::$transaction_response)) {
//Current Currency
$currency = GFCommon::get_currency();
$transaction_id = self::$transaction_response['transaction_id'];
$transaction_type = self::$transaction_response['transaction_type'];
$amount = array_key_exists('amount', self::$transaction_response) ? self::$transaction_response['amount'] : null;
$payment_date = gmdate('Y-m-d H:i:s');
$entry['currency'] = $currency;
if ('1' == $transaction_type) {
$entry['payment_status'] = 'Approved';
} else {
$entry['payment_status'] = 'Active';
}
$entry['payment_amount'] = $amount;
$entry['payment_date'] = $payment_date;
$entry['transaction_id'] = $transaction_id;
$entry['transaction_type'] = $transaction_type;
$entry['is_fulfilled'] = true;
//save card type since it gets stripped
$form_id = $entry['form_id'];
foreach ($form['fields'] as $field) {
if ('creditcard' == $field['type']) {
$creditcard_field_id = $field['id'];
}
}
$card_type_name = "input_" . $creditcard_field_id . "_4";
$card_type_id = $creditcard_field_id . ".4";
$card_type_value = rgpost($card_type_name);
$card_type_value = substr($card_type_value, 0, GFORMS_MAX_FIELD_LENGTH);
$lead_detail_table = RGFormsModel::get_lead_details_table_name();
$current_fields = $wpdb->get_results($wpdb->prepare("SELECT id, field_number FROM {$lead_detail_table} WHERE lead_id=%d", $entry_id));
$lead_detail_id = RGFormsModel::get_lead_detail_id($current_fields, $card_type_id);
if ($lead_detail_id > 0) {
$wpdb->update($lead_detail_table, array('value' => $card_type_value), array('id' => $lead_detail_id), array("%s"), array("%d"));
} else {
$wpdb->insert($lead_detail_table, array('lead_id' => $entry_id, 'form_id' => $form['id'], 'field_number' => $card_type_id, 'value' => $card_type_value), array("%d", "%d", "%f", "%s"));
}
$entry = apply_filters('gfp_stripe_entry_created_update_lead', $entry, self::$transaction_response);
RGFormsModel::update_lead($entry);
//saving feed id
$feed = self::$_this->get_feed($form);
gform_update_meta($entry_id, 'Stripe_feed_id', $feed['id']);
//updating form meta with current payment gateway
gform_update_meta($entry_id, 'payment_gateway', 'stripe');
$subscriber_id = apply_filters('gfp_stripe_entry_created_subscriber_id', '', self::$transaction_response, $entry);
GFP_Stripe_Data::insert_transaction($entry['id'], apply_filters('gfp_stripe_entry_created_insert_transaction_type', 'payment', $transaction_type), $subscriber_id, $transaction_id, $amount);
}
}
示例13: spgfle_gform_entry_id_pre_save_lead
/**
* Setup the current lead_id to update the entry
* instead of creating a new one
*/
function spgfle_gform_entry_id_pre_save_lead($entry_id, $form)
{
if (intval($entry_id) > 0) {
return $entry_id;
}
if (!$form['spgfle_enableedit']) {
return $entry_id;
}
$entry_id = (int) $_POST['gform_lead_id'];
$lead = RGFormsModel::get_lead($entry_id);
if (GFCommon::current_user_can_any('gravityforms_edit_entries') || $lead['created_by'] == wp_get_current_user()->ID) {
/**
* In case that GF only stores data for fields that are set
* we have to delete the old entry data
*/
global $wpdb;
$lead_details_table_name = RGFormsModel::get_lead_details_table_name();
$lead_details_long_table_name = RGFormsModel::get_lead_details_long_table_name();
$wpdb->query($wpdb->prepare("DELETE FROM {$lead_details_table_name} WHERE lead_id = %d", $entry_id));
//$wpdb->query( $wpdb->prepare( "DELETE FROM {$lead_details_long_table_name} WHERE lead_id = %d", $entry_id ) );
return $entry_id;
}
}
示例14: fix_checkbox_value
private static function fix_checkbox_value(){
global $wpdb;
$table_name = RGFormsModel::get_lead_details_table_name();
$sql = "select * from $table_name where value= '!'";
$results = $wpdb->get_results($sql);
foreach($results as $result){
$form = RGFormsModel::get_form_meta($result->form_id);
$field = RGFormsModel::get_field($form, $result->field_number);
if($field["type"] == "checkbox"){
$input = GFCommon::get_input($field, $result->field_number);
$wpdb->update($table_name, array("value" => $input["label"]), array("id" => $result->id));
}
}
}
示例15: ovr_delete_gf_entry
/**
* Delete Gravity Forms entry specified
* @global object $wpdb
*@param string $lead_id, id of gravity form entry to remove
*/
function ovr_delete_gf_entry($lead_id)
{
global $wpdb;
// Prepare variables.
$lead_table = RGFormsModel::get_lead_table_name();
$lead_notes_table = RGFormsModel::get_lead_notes_table_name();
$lead_detail_table = RGFormsModel::get_lead_details_table_name();
$lead_detail_long_table = RGFormsModel::get_lead_details_long_table_name();
// Delete from lead detail long.
$sql = $wpdb->prepare("DELETE FROM {$lead_detail_long_table} WHERE lead_detail_id IN(SELECT id FROM {$lead_detail_table} WHERE lead_id = %d)", $lead_id);
$wpdb->query($sql);
// Delete from lead details.
$sql = $wpdb->prepare("DELETE FROM {$lead_detail_table} WHERE lead_id = %d", $lead_id);
$wpdb->query($sql);
// Delete from lead notes.
$sql = $wpdb->prepare("DELETE FROM {$lead_notes_table} WHERE lead_id = %d", $lead_id);
$wpdb->query($sql);
// Delete from lead.
$sql = $wpdb->prepare("DELETE FROM {$lead_table} WHERE id = %d", $lead_id);
$wpdb->query($sql);
// Finally, ensure everything is deleted (like stuff from Addons).
GFAPI::delete_entry($lead_id);
}