| Post |
|
Guest
| Rob 7:45 am December 14, 2011
| |
|
|
Thanks for this amazing plugin!
I'm wondering if anyone has a read-made script that I can paste into the right place(s) which will show a direct link to the files that were uploaded with a form following successful submission. I want to give users a certainty that their file has been uploaded and showing a direct link would be the best way to do that.
We're running an art competition and in a previous edition we ended up with a lot of duplicate submissions, which I think is attributable to the fact that users were not entirely sure if we received their files. We do provide a confirmation email and are now redirecting them to a success page. But still, letting them click on links and see their files in our server's folder will really help.
Thanks for your help.
|
|
|
Guest
| Rob 10:12 pm December 17, 2011
| |
|
|
OK…
I found this which was very helpful. I think I'm almost there. I've set up my custom WP template with the following additional code:
<?php
/**
* Template Name: template name here
*/
$pdf1 = htmlspecialchars($_GET['varpdf1']);
get_header();
st_before_content($columns='');
echo '<p>Files uploaded successfully:<br/>';
echo "$pdf1<br/>";
get_template_part( 'loop', 'page' );
st_after_content();
get_sidebar('page');
get_footer();
?>
Then I modified my-functions.php in cforms to add the following:
function my_cforms_logic($cformsdata,$oldvalue,$setting) {
if ( $setting == "redirection" ){
$pdffilename1 = $cformsdata['data'][$cformsdata['data']['$$$1']];
if ( $cformsdata['id']==2 )
return 'http://mysite/succes…..ame1';
}
return $oldvalue;
}
All the success page returns is:
Files uploaded successfully:
$pdffilename1
Of course I'd rather that it had picked up the content of the variable definition.
What I don't understand is the syntax abbreviation:
return http://my.new.url.co…..#39;.$var2;
Can anyone help me specifically with this?
Thanks!
|
|
|
Guest
| Rob 10:26 pm December 17, 2011
| |
|
|
I see that —> return …httphere…my.new.url.com/?var1='.$var1.'&var2='.$var2 <— is the full text in the original reply to the other post, but it was cut off by an auto-shortening of links to be —> return http://my.new.url.co…..#39;.$var2; <— in the forum.
I still would like to know how to use the single quotes properly in this context. I''m not getting it.
return '…httphere…mysite.com/?varpdf1='.$pdffilename1'';
creates a syntax error maybe because of the double use of the single quote at the end?
Thank you.
|
|
|
Guest
| Rob 2:54 pm December 18, 2011
| |
|
|
OK. I have it, except for the NoID. I can't get that, but I'm very close. My template page is successfully getting the data that is passed through the URL redirect and I'm able to display the links with the following:
Files uploaded successfully:<br/>
<blockquote><a href="http://mysite.org/submissions/<?php echo htmlspecialchars($_GET['$varpdf1']); ?>">PDF File 1</a><br/>
my-functions.php now has the following:
function my_cforms_logic($cformsdata,$oldvalue,$setting) {
if ( $setting == "redirection" ){
$pdffilename1 = $cformsdata[$e['id']][$cformsdata['data']['$$$1']] . '-' . $cformsdata['data'][$cformsdata['data']['$$$1']];//this is obviously where the trouble lies…
if ( $cformsdata['id']==2 ) //this is form 2
return 'http://mysite.org/su…..' . $pdffilename1 . '&$varpdf2=' . $pdffilename2 . '&$varpdf3=' . $pdffilename3 . '&$varpdf4=' . $pdffilename4 . '&$varpdf5=' . $pdffilename5 . '';
}
return $oldvalue;
}
|
|
|
Guest
| Rob 10:35 pm December 19, 2011
| |
|
|
If anyone has a similar requirement, I finally got it working: It's probably very hacky (I'm not a programmer), but it works. If anyone has a smoother way to do this, please do let me know.
my-functions.php
function my_cforms_logic($cformsdata,$oldvalue,$setting) {
if ( $setting == "redirection" ){
$array = get_cforms_entries('Submission',false,false,'id',1,'desc');
foreach( $array as $e ){
if ( $cformsdata['id']==2 )
return 'http://mysite.org/su…..' . $e['id'] . '-' . $e['data']['First PDF File [*2]'] . '&$varpdf2=' . $e['id'] . '-' . $e['data']['Second PDF File [*2]'] . '&$varpdf3=' . $e['id'] . '-' . $e['data']['Third PDF File [*2]'] . '&$varpdf4=' . $e['id'] . '-' . $e['data']['Fourth PDF File [*2]'] . '&$varpdf5=' . $e['id'] . '-' . $e['data']['Project Narrative File [*2]'] . '';
}
}
return $oldvalue;
}
Your special page template in wordpress (assign it to the 'success' page)
<!doctype html>
<?php
/**
* Template Name: Success Upload Page
*/
// You can override via functions.php conditionals or define:
// $columns = 'four';
get_header();
st_before_content($columns='');
?>
<h2>Success!</h2>
blah blah blah … your text here.<br/><br/>
<a href="http://mysite.org/submissions/<?php echo htmlspecialchars($_GET['$varpdf1']); ?>" target="blank">PDF File 1</a><br/>
<a href="http://mysite.org/submissions/<?php echo htmlspecialchars($_GET['$varpdf2']); ?>" target="blank">PDF File 2</a><br/>
<a href="http://mysite.org/submissions/<?php echo htmlspecialchars($_GET['$varpdf3']); ?>" target="blank">PDF File 3</a><br/>
<a href="http://mysite.org/submissions/<?php echo htmlspecialchars($_GET['$varpdf4']); ?>" target="blank">PDF File 4</a><br/>
<a href="http://mysite.org/submissions/<?php echo htmlspecialchars($_GET['$varpdf5']); ?>" target="blank">Project Narrative DOC File</a>
<?php
get_template_part( 'loop', 'page' );
st_after_content();
get_sidebar('page');
get_footer();
?>
|
|
|
Guest
| PureEvil 10:28 am December 21, 2011
| |
|
|
Ok I need something like this!!! Can someone please help explain how I edit this…
I have a form with a captcha, upload field, and submit button…. that all works fine. I just need it to output the "Direct Link" address to the file in the success page. Can some one please help me with this!!!
Thank You,
PureEvil
http://www.AndroidArea51.com
p.s. Iam using the WordPress CformsII plugin if that makes a diffrence
|
|