Skip to content

Instantly share code, notes, and snippets.

@1844144
Last active May 30, 2023 14:09
Show Gist options
  • Save 1844144/6683f8c5faf91ea4b43cf32bc569b509 to your computer and use it in GitHub Desktop.
Save 1844144/6683f8c5faf91ea4b43cf32bc569b509 to your computer and use it in GitHub Desktop.
Formidable Forms: Create Entry, Update metas for existing entry
<?
$arg = array(
'form_id' => $opts['subscription_form'],
'item_key' => FrmAppHelper::get_unique_key(
'', $pre . 'frm_items', 'item_key', 0 ),
'item_meta' => array(
$opts['subscription_id'] => $payment->response->getSubscriptionId(),
$opts['subscription_pre_payment_id'] => $payment->entry->id,
$opts['subscription_date'] => $metas[$opts['recur_date']],
$opts['subscription_amount'] => $metas[$opts['recur_amount']],
$opts['subscription_interval'] => $opts['interval'],
$opts['subscription_interval_count'] => $opts['interval_count'],
),
);
FrmEntry::create($arg);
<?php
$fields = FrmField::get_all_for_form($form_id);
<?
global $wpdb;
$pre = $wpdb->prefix;
$pledge_entry = FrmEntry::getOne($pledge_entry_id, true);
$metas = $pledge_entry->metas;
$metas[1038] = $total;
$metas[1040] = $balance;
$metas[1016] = $status;
FrmEntryMeta::update_entry_metas($pledge_entry_id, $metas);
$time = current_time('mysql',1);
$sql="UPDATE {$pre}frm_items set updated_at='$time' where id={$pledge_entry_id}";
$wpdb->query($sql);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment