PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Retrive Form Object Data

  1. What is the best way to retrieve a forms' advanced properties - scheduled closing time in particular - from a page template that does not display the form?

    I have a form that submits custom post type entries and a separate page template that displays them. I'd like to indicate whether submissions are still possible w/o them having to go to the form to find out.

    For comparison, the following code works when called from the gform_validation hook:

    //Confirm end of auction + current server time
    $auctionCloseTime = strtotime($form['scheduleEnd'] . " " . $form['scheduleEndHour'] . ":" . $form['scheduleEndMinute'] . " " . $form['scheduleEndAmpm'] . " EST");

    and this code does similar check for a custom field date / time specific to the individual post type to apply a CSS class.

    <?php $closeEarlyDateTime = get_post_meta($post->ID, "closeEarlyDateTime", true);
    $closeEarlyDateTime = strtotime($closeEarlyDate . " EST");
    $currentTime = strtotime(date('m/d/Y h:i a'));
    
    if ($closeEarlyDateTime && $currentTime > $closeEarlyDateTime) {
    	$thumbnailClass = "thumbnailClosed";
    } else {
    	$thumbnailClass = "thumbnail";
    } 
    
    ?>
    <div class="<?php echo $thumbnailClass; ?>">
    	<a href="<?php the_permalink(); ?>">
    	<?php the_post_thumbnail(); ?>
    	</a>
    </div>
    Posted 13 years ago on Wednesday November 9, 2011 | Permalink