本文整理汇总了PHP中RGFormsModel::get_lead_detail_id方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::get_lead_detail_id方法的具体用法?PHP RGFormsModel::get_lead_detail_id怎么用?PHP RGFormsModel::get_lead_detail_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::get_lead_detail_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: directory_update_approved
static function directory_update_approved($lead_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0)
{
global $wpdb, $_gform_directory_approvedcolumn, $current_user;
$current_user = wp_get_current_user();
$user_data = get_userdata($current_user->ID);
if (!empty($approvedcolumn)) {
$_gform_directory_approvedcolumn = $approvedcolumn;
}
if (empty($_gform_directory_approvedcolumn)) {
return false;
}
$lead_detail_table = RGFormsModel::get_lead_details_table_name();
// This will be faster in the 1.6+ future.
if (function_exists('gform_update_meta')) {
gform_update_meta($lead_id, 'is_approved', $approved);
}
if (empty($approved)) {
//Deleting details for this field
$sql = $wpdb->prepare("DELETE FROM {$lead_detail_table} WHERE lead_id=%d AND field_number BETWEEN %f AND %f ", $lead_id, $_gform_directory_approvedcolumn - 0.001, $_gform_directory_approvedcolumn + 0.001);
$wpdb->query($sql);
RGFormsModel::add_note($lead_id, $current_user->ID, $user_data->display_name, stripslashes(__('Disapproved the lead', 'gravity-forms-addons')));
} else {
// Get the fields for the lead
$current_fields = $wpdb->get_results($wpdb->prepare("SELECT id, field_number FROM {$lead_detail_table} WHERE lead_id=%d", $lead_id));
$lead_detail_id = RGFormsModel::get_lead_detail_id($current_fields, $_gform_directory_approvedcolumn);
// If there's already a field for the approved column, then we update it.
if ($lead_detail_id > 0) {
$update = $wpdb->update($lead_detail_table, array("value" => $approved), array("lead_id" => $lead_id, 'form_id' => $form_id, 'field_number' => $_gform_directory_approvedcolumn), array("%s"), array("%d", "%d", "%f"));
} else {
$update = $wpdb->insert($lead_detail_table, array("lead_id" => $lead_id, "form_id" => $form_id, "field_number" => $_gform_directory_approvedcolumn, "value" => $approved), array("%d", "%d", "%f", "%s"));
}
RGFormsModel::add_note($lead_id, $current_user->ID, $user_data->display_name, stripslashes(__('Approved the lead', 'gravity-forms-addons')));
}
}
示例2: directory_update_approved
function directory_update_approved($lead_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0)
{
global $wpdb, $_gform_directory_approvedcolumn;
if (!empty($approvedcolumn)) {
$_gform_directory_approvedcolumn = $approvedcolumn;
}
if (empty($_gform_directory_approvedcolumn)) {
return false;
}
$lead_detail_table = RGFormsModel::get_lead_details_table_name();
// This will be faster in the 1.6+ future.
if (function_exists('gform_update_meta')) {
gform_update_meta($lead_id, 'is_approved', $approved);
}
if (empty($approved)) {
//Deleting details for this field
$sql = $wpdb->prepare("DELETE FROM {$lead_detail_table} WHERE lead_id=%d AND field_number BETWEEN %f AND %f ", $lead_id, $_gform_directory_approvedcolumn - 0.001, $_gform_directory_approvedcolumn + 0.001);
$wpdb->query($sql);
} else {
$current_fields = $wpdb->get_results($wpdb->prepare("SELECT id, field_number FROM {$lead_detail_table} WHERE lead_id=%d", $lead_id));
$lead_detail_id = RGFormsModel::get_lead_detail_id($current_fields, $_gform_directory_approvedcolumn);
if ($lead_detail_id > 0) {
$update = $wpdb->update($lead_detail_table, array("value" => $approved), array("lead_id" => $lead_id, 'form_id' => $form_id, 'field_number' => $_gform_directory_approvedcolumn), array("%s"), array("%d", "%d", "%f"));
} else {
$update = $wpdb->insert($lead_detail_table, array("lead_id" => $lead_id, "form_id" => $form_id, "field_number" => $_gform_directory_approvedcolumn, "value" => $approved), array("%d", "%d", "%f", "%s"));
}
}
}
示例3: 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);
}
}