本文整理汇总了PHP中RGFormsModel::update_lead_property方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::update_lead_property方法的具体用法?PHP RGFormsModel::update_lead_property怎么用?PHP RGFormsModel::update_lead_property使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::update_lead_property方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_entry_creator
/**
* When the entry creator is changed, add a note to the entry
* @param array $form GF entry array
* @param int $leadid Lead ID
* @return void
*/
function update_entry_creator($form, $leadid)
{
global $current_user;
// Update the entry
$created_by = intval(rgpost('created_by'));
RGFormsModel::update_lead_property($leadid, 'created_by', $created_by);
// If the creator has changed, let's add a note about who it used to be.
$originally_created_by = rgpost('originally_created_by');
if ($originally_created_by !== $created_by) {
$user_data = get_userdata($current_user->ID);
$user_format = __('%s (ID #%d)', 'gravity-view');
$original_name = $created_by_name = esc_attr__('No User', 'gravity-view');
if (!empty($originally_created_by)) {
$originally_created_by_user_data = get_userdata($originally_created_by);
$original_name = sprintf($user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID);
}
if (!empty($created_by)) {
$created_by_user_data = get_userdata($created_by);
$created_by_name = sprintf($user_format, $created_by_user_data->display_name, $created_by_user_data->ID);
}
RGFormsModel::add_note($leadid, $current_user->ID, $user_data->display_name, sprintf(__('Changed lead creator from %s to %s', 'gravity-forms-addons'), $original_name, $created_by_name));
}
}
示例2: send_to_paypal
public static function send_to_paypal($confirmation, $form, $entry, $ajax)
{
// ignore requests that are not the current form's submissions
if (RGForms::post("gform_submit") != $form["id"]) {
return $confirmation;
}
$config = self::get_active_config($form);
if (!$config) {
self::log_debug("NOT sending to PayPal: No PayPal setup was located for form_id = {$form['id']}.");
return $confirmation;
}
// updating entry meta with current feed id
gform_update_meta($entry["id"], "paypal_feed_id", $config["id"]);
// updating entry meta with current payment gateway
gform_update_meta($entry["id"], "payment_gateway", "paypal");
//updating lead's payment_status to Processing
RGFormsModel::update_lead_property($entry["id"], "payment_status", 'Processing');
//Getting Url (Production or Sandbox)
$url = $config["meta"]["mode"] == "production" ? self::$production_url : self::$sandbox_url;
$invoice_id = apply_filters("gform_paypal_invoice", "", $form, $entry);
$invoice = empty($invoice_id) ? "" : "&invoice={$invoice_id}";
//Current Currency
$currency = GFCommon::get_currency();
//Customer fields
$customer_fields = self::customer_query_string($config, $entry);
//Page style
$page_style = !empty($config["meta"]["style"]) ? "&page_style=" . urlencode($config["meta"]["style"]) : "";
//Continue link text
$continue_text = !empty($config["meta"]["continue_text"]) ? "&cbt=" . urlencode($config["meta"]["continue_text"]) : "&cbt=" . __("Click here to continue", "gravityformspaypal");
//If page is HTTPS, set return mode to 2 (meaning PayPal will post info back to page)
//If page is not HTTPS, set return mode to 1 (meaning PayPal will redirect back to page) to avoid security warning
$return_mode = GFCommon::is_ssl() ? "2" : "1";
$return_url = "&return=" . urlencode(self::return_url($form["id"], $entry["id"])) . "&rm={$return_mode}";
//Cancel URL
$cancel_url = !empty($config["meta"]["cancel_url"]) ? "&cancel_return=" . urlencode($config["meta"]["cancel_url"]) : "";
//Don't display note section
$disable_note = !empty($config["meta"]["disable_note"]) ? "&no_note=1" : "";
//Don't display shipping section
$disable_shipping = !empty($config["meta"]["disable_shipping"]) ? "&no_shipping=1" : "";
//URL that will listen to notifications from PayPal
$ipn_url = urlencode(get_bloginfo("url") . "/?page=gf_paypal_ipn");
$business_email = urlencode(trim($config["meta"]["email"]));
$custom_field = $entry["id"] . "|" . wp_hash($entry["id"]);
$url .= "?notify_url={$ipn_url}&charset=UTF-8¤cy_code={$currency}&business={$business_email}&custom={$custom_field}{$invoice}{$customer_fields}{$page_style}{$continue_text}{$cancel_url}{$disable_note}{$disable_shipping}{$return_url}";
$query_string = "";
switch ($config["meta"]["type"]) {
case "product":
$query_string = self::get_product_query_string($form, $entry);
break;
case "donation":
$query_string = self::get_donation_query_string($form, $entry);
break;
case "subscription":
$query_string = self::get_subscription_query_string($config, $form, $entry);
break;
}
$query_string = apply_filters("gform_paypal_query_{$form['id']}", apply_filters("gform_paypal_query", $query_string, $form, $entry), $form, $entry);
if (!$query_string) {
self::log_debug("NOT sending to PayPal: The price is either zero or the gform_paypal_query filter was used to remove the querystring that is sent to PayPal.");
return $confirmation;
}
$url .= $query_string;
$url = apply_filters("gform_paypal_request_{$form['id']}", apply_filters("gform_paypal_request", $url, $form, $entry), $form, $entry);
self::log_debug("Sending to PayPal: {$url}");
if (headers_sent() || $ajax) {
$confirmation = "<script>function gformRedirect(){document.location.href='{$url}';}";
if (!$ajax) {
$confirmation .= "gformRedirect();";
}
$confirmation .= "</script>";
} else {
$confirmation = array("redirect" => $url);
}
return $confirmation;
}
示例3: 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_id = $form["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";
$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;
$search_criteria["status"] = $status;
if ($star) {
$search_criteria["field_filters"][] = array("key" => "is_starred", "value" => (bool) $star);
}
if (!is_null($read)) {
$search_criteria["field_filters"][] = array("key" => "is_read", "value" => (bool) $read);
}
$search_field_id = rgget("field_id");
if (isset($_GET["field_id"]) && $_GET["field_id"] !== '') {
$key = $search_field_id;
$val = rgget("s");
$strpos_row_key = strpos($search_field_id, "|");
if ($strpos_row_key !== false) {
//multi-row likert
$key_array = explode("|", $search_field_id);
$key = $key_array[0];
$val = $key_array[1] . ":" . $val;
}
$type = rgget("type");
if (empty($type)) {
$type = rgget("field_id") == "0" ? "global" : "field";
}
$search_criteria["field_filters"][] = array("key" => $key, "type" => $type, "operator" => rgempty("operator", $_GET) ? "is" : rgget("operator"), "value" => $val);
}
$paging = array('offset' => $position, 'page_size' => 1);
if (!empty($sort_field)) {
$sorting = array('key' => $_GET["sort"], 'direction' => $sort_direction, 'is_numeric' => $is_numeric);
} else {
$sorting = array();
}
$total_count = 0;
$leads = GFAPI::get_entries($form['id'], $search_criteria, $sorting, $paging, $total_count);
$prev_pos = !rgblank($position) && $position > 0 ? $position - 1 : false;
$next_pos = !rgblank($position) && $position < $total_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 == $total_count) {
$next_pos = false;
}
}
if (!$lead_id) {
$lead = !empty($leads) ? $leads[0] : false;
} else {
$lead = GFAPI::get_entry($lead_id);
}
if (!$lead) {
_e("Oops! We couldn't find your entry. 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');
//Loading files that have been uploaded to temp folder
$files = GFCommon::json_decode(stripslashes(RGForms::post("gform_uploaded_files")));
if (!is_array($files)) {
$files = array();
}
GFFormsModel::$uploaded_files[$form_id] = $files;
GFFormsModel::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;
//.........这里部分代码省略.........
示例4: send_to_paypal
public static function send_to_paypal($confirmation, $form, $entry, $ajax)
{
// ignore requests that are not the current form's submissions
if (RGForms::post("gform_submit") != $form["id"]) {
return $confirmation;
}
$config = self::get_active_config($form);
if (!$config) {
return $confirmation;
}
//updating lead's payment_status to Processing
RGFormsModel::update_lead_property($entry["id"], "payment_status", 'Processing');
//Getting Url (Production or Sandbox)
$url = $config["meta"]["mode"] == "production" ? self::$production_url : self::$sandbox_url;
$invoice_id = apply_filters("gform_paypal_invoice", "", $form, $entry);
$invoice = empty($invoice_id) ? "" : "&invoice={$invoice_id}";
//Current Currency
$currency = GFCommon::get_currency();
//Customer fields
$customer_fields = self::customer_query_string($config, $entry);
//Page style
$page_style = !empty($config["meta"]["style"]) ? "&page_style=" . urlencode($config["meta"]["style"]) : "";
//Continue link text
$continue_text = !empty($config["meta"]["continue_text"]) ? "&cbt=" . urlencode($config["meta"]["continue_text"]) : "&cbt=" . __("Click here to continue", "gravityformspaypal");
$return_url = "&return=" . urlencode(self::return_url($form["id"], $entry["id"])) . "&rm=2";
//Cancel URL
$cancel_url = !empty($config["meta"]["cancel_url"]) ? "&cancel_return=" . urlencode($config["meta"]["cancel_url"]) : "";
//Don't display note section
$disable_note = !empty($config["meta"]["disable_note"]) ? "&no_note=1" : "";
//Don't display shipping section
$disable_shipping = !empty($config["meta"]["disable_shipping"]) ? "&no_shipping=1" : "";
//URL that will listen to notifications from PayPal
$ipn_url = urlencode(get_bloginfo("url") . "/?page=gf_paypal_ipn");
$business_email = urlencode(trim($config["meta"]["email"]));
$custom_field = $entry["id"] . "|" . wp_hash($entry["id"]);
$url .= "?notify_url={$ipn_url}&charset=UTF-8¤cy_code={$currency}&business={$business_email}&custom={$custom_field}{$invoice}{$customer_fields}{$page_style}{$continue_text}{$cancel_url}{$disable_note}{$disable_shipping}{$return_url}";
$query_string = "";
switch ($config["meta"]["type"]) {
case "product":
$query_string = self::get_product_query_string($form, $entry);
break;
case "donation":
$query_string = self::get_donation_query_string($form, $entry);
break;
case "subscription":
$query_string = self::get_subscription_query_string($config, $form, $entry);
break;
}
if (!$query_string) {
return $confirmation;
}
$url .= apply_filters("gform_paypal_query_{$form['id']}", apply_filters("gform_paypal_query", $query_string, $form, $entry), $form, $entry);
if (headers_sent() || $ajax) {
$confirmation = "<script>function gformRedirect(){document.location.href='{$url}';}";
if (!$ajax) {
$confirmation .= "gformRedirect();";
}
$confirmation .= "</script>";
} else {
$confirmation = array("redirect" => $url);
}
return $confirmation;
}
示例5: update_lead_status
public static function update_lead_status()
{
check_ajax_referer('gf_delete_entry');
$status = rgpost("status");
$lead_id = rgpost("entry");
switch ($status) {
case "unspam":
//TODO: call akismet and set entry as not spam.
RGFormsModel::update_lead_property($lead_id, "status", "active");
break;
case "delete":
RGFormsModel::delete_lead($lead_id);
break;
default:
RGFormsModel::update_lead_property($lead_id, "status", $status);
break;
}
header("Content-Type: text/xml");
echo "<?xml version='1.0' standalone='yes'?><wp_ajax></wp_ajax>";
exit;
}
示例6: update_lead_status
/**
* Updates the entry status
*
* Called via AJAX
* Passes data off to either RGFormsModel::update_lead_property or RGFormsModel::delete_lead
*
* @access public
* @static
* @see RGFormsModel::update_lead_property
* @see RGFormsModel::delete_lead
*/
public static function update_lead_status()
{
check_ajax_referer('gf_delete_entry');
$status = rgpost('status');
$lead_id = rgpost('entry');
$entry = GFAPI::get_entry($lead_id);
$form = GFAPI::get_form($entry['form_id']);
switch ($status) {
case 'unspam':
RGFormsModel::update_lead_property($lead_id, 'status', 'active');
break;
case 'delete':
if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
RGFormsModel::delete_lead($lead_id);
}
break;
default:
RGFormsModel::update_lead_property($lead_id, 'status', $status);
break;
}
require_once 'entry_list.php';
$filter_links = GFEntryList::get_filter_links($form);
$counts = array();
foreach ($filter_links as $filter_link) {
$id = $filter_link['id'] == '' ? 'all' : $filter_link['id'];
$counts[$id . '_count'] = $filter_link['count'];
}
$x = new WP_Ajax_Response();
$x->add(array('what' => 'gf_entry', 'id' => $lead_id, 'supplemental' => $counts));
$x->send();
}
示例7: send_to_paytm_form
public static function send_to_paytm_form($confirmation, $form, $entry, $ajax)
{
// ignore requests that are not the current form's submissions
if (RGForms::post("gform_submit") != $form["id"]) {
return $confirmation;
}
$settings = get_option("gf_paytm_form_settings");
$paytm_mid = rgar($settings, "paytm_mid");
$paytm_mode = rgar($settings, "paytm_mode");
$paytm_callback = rgar($settings, "paytm_callback");
$paytm_channel_id = rgar($settings, "paytm_channel_id");
$paytm_industry_type_id = rgar($settings, "paytm_industry_type_id");
$paytm_key = rgar($settings, "paytm_key");
$paytm_website = rgar($settings, "paytm_website");
$config = GFPaytmFormData::get_feed_by_form($form["id"]);
if (!$config) {
self::log_debug("NOT sending to Paytm Form: No Paytm Form setup was located for form_id = {$form['id']}.");
return $confirmation;
} else {
$config = $config[0];
//using first sagepayform feed (only one sagepayform feed per form is supported)
}
// updating entry meta with current feed id
gform_update_meta($entry["id"], "paytm_form_feed_id", $config["id"]);
// updating entry meta with current payment gateway
gform_update_meta($entry["id"], "payment_gateway", "paytmform");
//updating lead's payment_status to Processing
RGFormsModel::update_lead_property($entry["id"], "payment_status", 'Processing');
//Getting Url (Production or Sandbox)
if ($paytm_mode == 'test') {
$redirect_url = 'https://pguat.paytm.com/oltp-web/processTransaction';
} else {
if ($paytm_mode == 'production') {
$redirect_url = 'https://secure.paytm.in/oltp-web/processTransaction';
}
}
$invoice_id = apply_filters("gform_paytm_form_invoice", "", $form, $entry);
$red = $entry['id'];
$invoice = empty($invoice_id) ? $red : $invoice_id;
//Current Currency
$currency = GFCommon::get_currency();
//Customer fields
$fields = "";
$first_name = "";
$last_name = "";
$phone = "";
$email = "";
foreach (self::get_customer_fields() as $field) {
$field_id = $config["meta"]["customer_fields"][$field["name"]];
$value = rgar($entry, $field_id);
if ($field["name"] == "first_name") {
$first_name = $value;
$value = '';
} else {
if ($field["name"] == "last_name") {
$last_name = $value;
$value = '';
} else {
if ($field["name"] == "phone") {
$phone = $value;
$value = '';
} else {
if ($field["name"] == "email") {
$email = $value;
$value = '';
} else {
if ($field["name"] == "amount") {
$amount = $value;
$value = '';
}
}
}
}
}
}
$time_stamp = date("ymdHis");
$orderid = $time_stamp . "-" . $invoice;
/*
$paytm_arg['CustomerName'] = substr($first_name.' '.$last_name, 0, 100);
$paytm_arg['CustomerEMail'] = substr($email, 0, 255);
$paytm_arg['BillingPostCode'] = substr($postcode, 0, 10);
$paytm_arg['BillingCountry'] = $country;
$paytm_arg['BillingPhone'] = substr($phone, 0, 20);
$paytm_arg['DeliveryPostCode'] = substr($postcode, 0, 10);
$paytm_arg['DeliveryCountry'] = $country;
$paytm_arg['DeliveryPhone'] = substr($phone, 0, 20);
$paytm_arg['FailureURL'] = get_bloginfo("url") . "/?page=gf_paytm_form_ipn";
$paytm_arg['SuccessURL'] = get_bloginfo("url") . "/?page=gf_paytm_form_ipn";*/
$paytm_arg['REQUEST_TYPE'] = 'DEFAULT';
$paytm_arg['MID'] = $paytm_mid;
$paytm_arg['WEBSITE'] = $paytm_website;
$paytm_arg['INDUSTRY_TYPE_ID'] = $paytm_industry_type_id;
$paytm_arg['CHANNEL_ID'] = $paytm_channel_id;
$paytm_arg['ORDER_ID'] = $orderid;
$paytm_arg['CUST_ID'] = $email;
//.........这里部分代码省略.........
示例8: lead_detail_page
public static function lead_detail_page()
{
global $current_user;
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$form = RGFormsModel::get_form_meta(absint($_GET['id']));
$form_id = absint($form['id']);
$form = apply_filters('gform_admin_pre_render_' . $form_id, apply_filters('gform_admin_pre_render', $form));
$lead_id = absint(rgget('lid'));
$filter = rgget('filter');
$status = in_array($filter, array('trash', 'spam')) ? $filter : 'active';
$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;
$search_criteria['status'] = $status;
if ($star) {
$search_criteria['field_filters'][] = array('key' => 'is_starred', 'value' => (bool) $star);
}
if (!is_null($read)) {
$search_criteria['field_filters'][] = array('key' => 'is_read', 'value' => (bool) $read);
}
$search_field_id = rgget('field_id');
if (isset($_GET['field_id']) && $_GET['field_id'] !== '') {
$key = $search_field_id;
$val = rgget('s');
$strpos_row_key = strpos($search_field_id, '|');
if ($strpos_row_key !== false) {
//multi-row likert
$key_array = explode('|', $search_field_id);
$key = $key_array[0];
$val = $key_array[1] . ':' . $val;
}
$search_criteria['field_filters'][] = array('key' => $key, 'operator' => rgempty('operator', $_GET) ? 'is' : rgget('operator'), 'value' => $val);
$type = rgget('type');
if (empty($type)) {
if (rgget('field_id') == '0') {
$search_criteria['type'] = 'global';
}
}
}
$paging = array('offset' => $position, 'page_size' => 1);
if (!empty($sort_field)) {
$sorting = array('key' => $_GET['sort'], 'direction' => $sort_direction, 'is_numeric' => $is_numeric);
} else {
$sorting = array();
}
$total_count = 0;
$leads = GFAPI::get_entries($form['id'], $search_criteria, $sorting, $paging, $total_count);
$prev_pos = !rgblank($position) && $position > 0 ? $position - 1 : false;
$next_pos = !rgblank($position) && $position < $total_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 == $total_count) {
$next_pos = false;
}
}
if (!$lead_id) {
$lead = !empty($leads) ? $leads[0] : false;
} else {
$lead = GFAPI::get_entry($lead_id);
}
if (!$lead) {
esc_html_e("Oops! We couldn't find your entry. 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');
//Loading files that have been uploaded to temp folder
$files = GFCommon::json_decode(stripslashes(RGForms::post('gform_uploaded_files')));
if (!is_array($files)) {
$files = array();
}
GFFormsModel::$uploaded_files[$form_id] = $files;
GFFormsModel::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')) {
GFCommon::log_debug('GFEntryDetail::lead_detail_page(): Preparing to email entry notes.');
$email_to = $_POST['gentry_email_notes_to'];
$email_from = $current_user->user_email;
$email_subject = stripslashes($_POST['gentry_email_subject']);
$body = stripslashes($_POST['new_note']);
$headers = "From: \"{$email_from}\" <{$email_from}> \r\n";
//.........这里部分代码省略.........
示例9: update_lead_property
public static function update_lead_property()
{
check_ajax_referer('rg_update_lead_property', 'rg_update_lead_property');
RGFormsModel::update_lead_property($_POST["lead_id"], $_POST["name"], $_POST["value"]);
}
示例10: form_save_confirmation
public function form_save_confirmation($confirmation, $form, $lead, $ajax)
{
if (!isset($form['enableFormState']) || !$form['enableFormState']) {
return $confirmation;
}
$user = wp_get_current_user();
if (!isset($_POST['gform_save_state_' . $form['id']])) {
if (!empty($form['enableFormStateOnSubmit']) && $form['enableFormStateOnSubmit']) {
/* still save, but do submit, thanks */
update_user_meta($user->ID, 'completed_form_' . $form['id'], $lead['id']);
update_user_meta($user->ID, 'has_pending_form_' . $form['id'], $lead['id']);
return $confirmation;
}
/* remove all saved data for this form and user */
delete_user_meta($user->ID, 'has_pending_form_' . $form['id']);
update_user_meta($user->ID, 'completed_form_' . $form['id'], $lead['id']);
return $confirmation;
}
if (!isset($_POST['gform_save_state_' . $form['id']])) {
return $confirmation;
}
/* this should never happend */
/* set pending to user id */
gform_update_meta($lead['id'], 'is_pending', $user->ID);
/* set latest pending */
update_user_meta($user->ID, 'has_pending_form_' . $form['id'], $lead['id']);
/* set lead to pending */
RGFormsModel::update_lead_property($lead['id'], 'status', 'pending', false, true);
do_action('gform_save_state', $form, $lead);
$confirmation = __('Your progress has been saved. You can return to this form anytime in the future to complete it.');
return $confirmation;
}
示例11: 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_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"]);
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"]);
?>
';
//.........这里部分代码省略.........
示例12: lead_detail_page
public static function lead_detail_page()
{
global $current_user;
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$requested_form_id = absint($_GET['id']);
if (empty($requested_form_id)) {
return;
}
$lead = self::get_current_entry();
if (is_wp_error($lead) || !$lead) {
esc_html_e("Oops! We couldn't find your entry. Please try again", 'gravityforms');
return;
}
$lead_id = $lead['id'];
$form = self::get_current_form();
$form_id = absint($form['id']);
$total_count = self::get_total_count();
$position = rgget('pos') ? rgget('pos') : 0;
$prev_pos = !rgblank($position) && $position > 0 ? $position - 1 : false;
$next_pos = !rgblank($position) && $position < self::$_total_count - 1 ? $position + 1 : false;
$filter = rgget('filter');
// 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 == $total_count) {
$next_pos = false;
}
}
RGFormsModel::update_lead_property($lead['id'], 'is_read', 1);
switch (RGForms::post('action')) {
case 'update':
check_admin_referer('gforms_save_entry', 'gforms_save_entry');
//Loading files that have been uploaded to temp folder
$files = GFCommon::json_decode(stripslashes(RGForms::post('gform_uploaded_files')));
if (!is_array($files)) {
$files = array();
}
$original_entry = $lead;
GFFormsModel::$uploaded_files[$form_id] = $files;
GFFormsModel::save_lead($form, $lead);
/**
* Fires after the Entry is updated from the entry detail page.
*
* @param array $form The form object for the entry.
* @param integer $lead['id'] The entry ID.
* @param array $original_entry The entry object before being updated.
*/
gf_do_action(array('gform_after_update_entry', $form['id']), $form, $lead['id'], $original_entry);
$lead = RGFormsModel::get_lead($lead['id']);
$lead = GFFormsModel::set_entry_meta($lead, $form);
self::set_current_entry($lead);
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')) {
GFCommon::log_debug('GFEntryDetail::lead_detail_page(): Preparing to email entry notes.');
$email_to = $_POST['gentry_email_notes_to'];
$email_from = $current_user->user_email;
$email_subject = stripslashes($_POST['gentry_email_subject']);
$body = stripslashes($_POST['new_note']);
$headers = "From: \"{$email_from}\" <{$email_from}> \r\n";
GFCommon::log_debug("GFEntryDetail::lead_detail_page(): Emailing notes - TO: {$email_to} SUBJECT: {$email_subject} BODY: {$body} HEADERS: {$headers}");
$is_success = wp_mail($email_to, $email_subject, $body, $headers);
$result = is_wp_error($is_success) ? $is_success->get_error_message() : $is_success;
GFCommon::log_debug("GFEntryDetail::lead_detail_page(): Result from wp_mail(): {$result}");
if (!is_wp_error($is_success) && $is_success) {
GFCommon::log_debug('GFEntryDetail::lead_detail_page(): Mail was passed from WordPress to the mail server.');
} else {
GFCommon::log_error('GFEntryDetail::lead_detail_page(): The mail message was passed off to WordPress for processing, but WordPress was unable to send the message.');
}
if (has_filter('phpmailer_init')) {
GFCommon::log_debug(__METHOD__ . '(): The WordPress phpmailer_init hook has been detected, usually used by SMTP plugins, it can impact mail delivery.');
}
/**
* Fires after a note is attached to an entry and sent as an email
*
* @param string $result The Error message or success message when the entry note is sent
* @param string $email_to The email address to send the entry note to
* @param string $email_from The email address from which the email is sent from
* @param string $email_subject The subject of the email that is sent
* @param mixed $body The Full body of the email containing the message after the note is sent
* @param array $form The current form object
* @param array $lead The Current lead object
*/
do_action('gform_post_send_entry_note', $result, $email_to, $email_from, $email_subject, $body, $form, $lead);
}
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');
//.........这里部分代码省略.........
示例13: 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"));
?>
//.........这里部分代码省略.........
示例14: update_entry_creator
/**
* When the entry creator is changed, add a note to the entry
* @param array $form GF entry array
* @param int $entry_id Entry ID
* @return void
*/
function update_entry_creator($form, $entry_id)
{
global $current_user;
// Update the entry
$created_by = absint(rgpost('created_by'));
RGFormsModel::update_lead_property($entry_id, 'created_by', $created_by);
// If the creator has changed, let's add a note about who it used to be.
$originally_created_by = rgpost('originally_created_by');
// If there's no owner and there didn't used to be, keep going
if (empty($originally_created_by) && empty($created_by)) {
return;
}
// If the values have changed
if (absint($originally_created_by) !== absint($created_by)) {
$user_data = get_userdata($current_user->ID);
$user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview');
$original_name = $created_by_name = esc_attr_x('No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview');
if (!empty($originally_created_by)) {
$originally_created_by_user_data = get_userdata($originally_created_by);
$original_name = sprintf($user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID);
}
if (!empty($created_by)) {
$created_by_user_data = get_userdata($created_by);
$created_by_name = sprintf($user_format, $created_by_user_data->display_name, $created_by_user_data->ID);
}
RGFormsModel::add_note($entry_id, $current_user->ID, $user_data->display_name, sprintf(__('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name), 'gravityview');
}
}
示例15: paypalpro_after_submission
public static function paypalpro_after_submission($entry, $form)
{
$payment_method = self::get_payment_method();
if (empty(self::$transaction_response) && $payment_method != "paypalpro") {
return;
}
//other feed being used
//updating form meta with current feed id
gform_update_meta($entry["id"], "paypalpro_feed_id", self::$transaction_response['config_id']);
//updating form meta with current payment gateway
gform_update_meta($entry["id"], "payment_gateway", "paypalpro");
//updating form meta with current payment method
gform_update_meta($entry["id"], "payment_method", self::get_payment_method());
if ($payment_method == "paypalpro") {
//updating lead's payment_status to Processing
RGFormsModel::update_lead_property($entry["id"], "payment_status", 'Processing');
} else {
if (!empty(self::$transaction_response)) {
$is_recurring = self::$transaction_response["transaction_type"] == 2;
self::confirm_payment($entry, $form, rgar(self::$transaction_response, "subscription_id"), self::$transaction_response["transaction_id"], $is_recurring, rgar(self::$transaction_response, "initial_payment_amount"), rgar(self::$transaction_response, "subscription_amount"), false, true);
}
}
}