Getting PDF form ID inside gravity form loop
-
Hi,
I’m looping through every Gravity Form I have created using form id and the rgar function. I’m retrieving all the information from the form correctly, but I need to retrieve the PDF form ID as well in order to built a download link.
Could you please share, how this can be achieved? Below is my code. $pdf_id is the variable in need to get.
`for( $i=1; $i<=1000; $i++ ){
$form_id = $i;
$search_criteria = array();
$sorting = array();
$paging = array( ‘offset’ => 0, ‘page_size’ => 25 );
$total_count = 0;
$entries = GFAPI::get_entries( $form_id, $search_criteria, $sorting, $paging, $total_count );$entry_counter = 0;
foreach ( $entries as $entry ) :
$entry_counter++;
$url = “http://localhost/nitra-2/wp-admin/admin.php?page=gf_entries&view=entry&id=” . $form_id . “&lid=” . $entry_counter;
$source_url = rgar( $entry, ‘source_url’ );
$form_user_id = rgar( $entry, ‘created_by’ );
$entry_id = rgar( $entry, ‘id’ );
$pdf_id = rgar( $entry, ‘pid’ );
?>
<?php if( $user_id === $form_user_id ) : ?>
<p style=”padding: 30px; border: 1px solid #000;”>
<strong>Formulár č. <?php echo $form_id; ?></strong><br>
<?php echo rgar( $entry, ‘1’ ) . ‘, ID: ‘ . rgar( $entry, ‘id’ ) . ‘, SOURCE URL:<a href=”‘ . $source_url .'”>’ . $source_url . ‘</a><br>’;?>
<a href=”<?php echo $url; ?>”>ENTRY URL</a><br>
ENTRY ID: <?php echo $entry_id; ?><br>
PID: <?php echo $pdf_id; ?>
</p>
<?php endif; ?>
<?php endforeach;
}`Regards
The topic ‘Getting PDF form ID inside gravity form loop’ is closed to new replies.