Displaying Payment & Subscription Info in a View

Est. Reading: 1 minute
By: mjmaso
Created: 01/19/2017
Category:
Difficulty: Intermediate

Displaying Payment & Subscription Info in a View

×Warning: This tutorial was created 2643 days ago. Some of the information may be out of date with more recent versions of Formidable. Please proceed with caution and always perform a backup before adding custom code.
add_shortcode('frm_payment_status', 'frm_payment_status')
function frm_payment_status($atts){
extract(shortcode_atts(array('id' => false, 'field' => ''), $atts));
if(!$id) return ''; //if no entry id is specified, then don't return anything
global $wpdb;
$completed = $wpdb->get_var($wpdb->prepare("SELECT $field FROM {$wpdb->prefix}frm_payments WHERE item_id=%d", (int) $id));
if ( $field != 'status' ){
return $completed;
} else {
return $completed ? 'Complete' : 'Not complete'; //change your text here
}
}

add_shortcode('frm_subscription_status', 'frm_subscription_status');
function frm_subscription_status($atts){
extract(shortcode_atts(array('id' => false, 'field' => ''), $atts));
if(!$id) return ''; //if no entry id is specified, then don't return anything
global $wpdb;
$result = $wpdb->get_var($wpdb->prepare("SELECT $field FROM {$wpdb->prefix}frm_subscriptions WHERE item_id=%d", (int) $id));
return $result;
}

One comment on “Displaying Payment & Subscription Info in a View”

Leave a Reply

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crosschevron-leftchevron-rightarrow-right