Topic RSS
10:21 am
Please replace the ??? with your data!
- URL to the FORM: http://www.pressreleasepivot.com/press-release-submission
- The browser used: FF 3.0.13
- cforms version: 10.6
- Your Wordpress version: 2.8.4
Thank you for this tremendous plug-in you are very generous to spend so much time in developing and maintaining it.
If at all possible I would like to be able to access the tracking ID (the 'sub_id' value from the table 'cformsdata') from the actions() function in my-functions.php to build a link to an uploaded file. I have searched extensively through the forums in order to find a solution but have been unable to attain the desired outcome.
I understand that I can access the tracking ID by using the 'get_cforms_entries' API call as stated in the forums here and here and have done so successfully.
I understand that I am supposed to be able to access the tracking ID as a predefined variable as stated in the help documentation. I believe, although I need to test again, that the substitution happens correctly if using the '{ID}' placeholder in the admin email but I would like to access it from my-functions.php
This particular situation requires me to be able to access the filename from the submitted form data but as you well know I also need the tracking ID (noid) to correctly form the file link. I have tried adding {ID} as the default value to a hidden field but no substitution occurs and I am left with the string '{ID}' as the submitted value.
I could query the database directly from the actions() function but I would need a unique identifier to extract a single record. If at all possible I would like to use the one that already exists.
Is it possible to access the tracking id from the actions() function in my-functions.php so as to correctly form the link to the file?
If so how can I go about doing so?
Many Thanks,
Spence
6:25 pm
March 6, 2005
Offlinedrakemolatov said:
If at all possible I would like to be able to access the tracking ID (the 'sub_id' value from the table 'cformsdata') from the actions() function in my-functions.php to build a link to an uploaded file.
try adding a global $subID; to your action function.
This particular situation requires me to be able to access the filename from the submitted form data but as you well know I also need the tracking ID (noid) to correctly form the file link. I have tried adding {ID} as the default value to a hidden field but no substitution occurs and I am left with the string '{ID}' as the submitted value.
ps: cforms v11 will come with an option to turn off the file-upload-name-tracking-prefix. which of course bears the risk that files can be overwritten if they have the same name, but if that's a non issue for you, it could make things a lot easier.
2:49 am
Oliver said:
try adding a global $subID; to your action function.
Thanks Oliver this solution works perfectly. Ideally the 'sub_id' would be available without using globals but for this applicaiton it is adequate.
ps: cforms v11 will come with an option to turn off the file-upload-name-tracking-prefix. which of course bears the risk that files can be overwritten if they have the same name, but if that's a non issue for you, it could make things a lot easier.
I like the fact that each uploaded file is assigned a unique identifier as it prevents collisions. I just needed a way to access the id.
Thanks again for all your hard work. You have made a wonderful tool for people.
5:59 pm
Buy adding the 'global $subID' in a local context, it sets the local $subID to the global value.
I just learned some php :-)
2:59 pm
March 6, 2005
Offline6:18 am
Oliver,
The global is nice but why not add the subid as an array element in $cformsdata array that is passed to the
function my_cforms_action as well. Seem like it would be a easy and beneficial add on since you are pulling from the database to make the array already, which means you know the subid.
Just my 2cents.
Great plugin.
Most Users Ever Online: 959
Currently Online:
80 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
tracedef: 43
mores: 21
Gyrus: 20
frozenwaste: 18
asuffredini: 15
photoworks: 14
Member Stats:
Guest Posters: 3548
Members: 1464
Moderators: 3
Admins: 1
Forum Stats:
Groups: 1
Forums: 4
Topics: 5157
Posts: 18385
Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass
Moderators: Paul (421), cnymike (8), sonika (95)
Administrators: Oliver (6398)
FAQs
Home
Add Reply
Add Topic
Quote










