Hey guys - I wrote a shortcode that allows you to display the amount of entries left as a shortcode.
Its useful if you want to put a link to a page with a form on it, and display the amount of entries left. I've also made it so if there are 0 entries left, it says its sold out...you can customize that if you want.
add this to your functions and [spotsleft id="x"] will be the shortcode on your site. x will be the id of the form.
[php]
function spotsleftShortcode($atts, $content=null) {
extract(shortcode_atts(array(
'id' => ''
), $atts));
$form_id = $id;
$form = RGFormsModel::get_form_meta($form_id);
$entry_count = RGFormsModel::get_lead_count($form['id'], '');
$entries_left = $form["limitEntriesCount"] - $entry_count;
if($entries_left > 1):
$entries_left_message = $form['title']. ' – Only ' . $entries_left . ' spots left!';
elseif($entries_left == 1):
$entries_left_message = $form['title']. ' – Only ' . $entries_left . ' spot left!';
else:
$entries_left_message = $form['title']. ' – Currently sold out. Please fill out our waiting list if you wish to join';
endif;
return $entries_left_message;
}
add_shortcode('spotsleft', 'spotsleftShortcode');