Font end entry
-
Hello,
When i use gravity form default upload i use to print picture in front end
$value = rgar( $entry, ’36’);
$files = json_decode( $value, true );
rgar( $files,0)But when i use this with your plugin nothing^^
How can i do ?
Regards
https://ww.wp.xz.cn/plugins/gravity-forms-advanced-file-uploader/
-
Try this, replace this code:
function calculateAge($dob, $date=null) {
$dob = strtotime($dob);
$date = $date ? strtotime($date) : time();
// Calculate the age
$age = date(‘Y’, $date)-date(‘Y’, $dob);
// Correct age for leap year
return (date(‘md’, date(‘U’, $dob)) > date(‘md’, date(‘U’, $date)))
? $age-1 : $age;
}
//Choix du formulaire
$form_id = 1;
$search_criteria = array(
‘status’ => ‘active’,
‘field_filters’ => array(
‘mode’ => ‘any’,
array(
‘key’ => ‘payment_status’,
‘value’ => ‘Paid’
),
array(
‘key’ => ’22’,
‘operator’ => ‘=’,
‘value’ => ‘NOW()’
)
)
);$my_param = $_GET[‘urlparams’];
$perPage = 10;
$total_count= GFAPI::count_entries( $form_id, $search_criteria );// Nombre total de page
$nbPage = ceil($total_count/$perPage);
if (isset($my_param) && $my_param>0 && $my_param ‘date_created’, ‘direction’ => ‘DESC’ );
$paging = array( ‘offset’ => (($sPage-1)*$perPage) , ‘page_size’ => $perPage );
$entries = GFAPI::get_entries( $form_id, $search_criteria, $sorting, $paging, $total_count );
echo ”;
foreach($entries as $entry) {
echo ”;
echo ” . rgar( $entry,’6.3′) . ‘ ‘ . rgar( $entry,’6.6′) .’ (Age:’.calculateAge(rgar( $entry,’4′),rgar( $entry,’12’)).’)’;
echo ”;//Echo out file urls
get_entry_files( $entry );echo ”;
echo ‘ Place of Birth:’ ;
echo ” . rgar( $entry,’11’) . ‘ ‘;
echo ”;
echo ‘ Place of Death:’;
echo ‘ ‘ . rgar( $entry,’13’) . ‘ ‘;
echo ”;
echo ‘ Date of death:’;
echo ” . rgar( $entry,’12’) . ‘ ‘;
echo ”;
}echo ”;
if(!empty($my_param) AND intval($my_param)>0 AND intval($my_param)1){
// echo “Première page “;
$precedent=$sPage-1;
echo ” > “;
// echo “Dernière page “;
}function get_entry_files( $entry ) {
//Vars
$uploader_field_number = 36;
$file_array = array();
$file_urls = array();//Check for uploader field
if( isset($entry[ $uploader_field_number ]) ) {$file_array = maybe_unserialize( $entry[ $uploader_field_number ] );
//Loop file array and cache url for each file
foreach( $file_array as $file_id ) {$file_urls[] = wp_get_attachment_url( $file_id );
}
}
//output urls
foreach( $file_urls as $url ) {echo $url;
}
}
http://www.inrunews.com/wp-content/uploads/2015/08/d337652417f36840a81c18de34e0c779.jpghttp://www.inrunews.com/wp-content/uploads/2015/08/feb25f46dcbfd73ba6fec2cd9ce03f9d.jpghttp://www.inrunews.com/wp-content/uploads/2015/08/cc750e1627982919819a17938a72f4b2.jpghttp://www.inrunews.com/wp-content/uploads/2015/08/cce954a07c4f6851bde98a5a3e550749.jpg
Warning: Invalid argument supplied for foreach() in /home/inrunews/public_html/wp-content/plugins/global-content-blocks/global-content-blocks.php(322) : eval()’d code on line 112Cool.
Replace this function again and it will output the images for you:
function get_entry_files( $entry ) {
//Vars
$uploader_field_number = 36;
$file_array = array();
$images = array();//Check for uploader field
if( isset($entry[ $uploader_field_number ]) ) {$file_array = maybe_unserialize( $entry[ $uploader_field_number ] );
//Loop file array and cache url for each file
foreach( $file_array as $file_id ) {$images[] = wp_get_attachment_image( $file_id, ‘full’ );
}
}
//output urls
foreach( $images as $image ) {echo $image;
}
}
why this ? in the html source
<img class=”avisImages” src=”. get_entry_files( $entry) .”>oopss forget it it’s works i’m too tired xd
Ty very much for your time !!!
And is there a way to have easy the first image ?
or i break the foreach
Warning: Invalid argument supplied for foreach() in /home/inrunews/public_html/wp-content/plugins/global-content-blocks/global-content-blocks.php(322) : eval()’d code on line 112
after the images i have this error
Good night and ty
The topic ‘Font end entry’ is closed to new replies.