Plugin Author
YOP
(@yourownprogrammer)
Hi DreamsFulfilledAgents,
You are looking for the insert_vote_custom_field_in_database function, located in inc/yop_poll_model.php, approximately on line 2272.
Regards,
YOP Team
Thank you very much for that. I found a couple of tutorials on how to do this, but none of them work. Is there a way to modify that function to automatically send those variables to http://contact-management-processing/SubmitAction.do
without redirecting the user to the site, or forcing the end user to make an additional click?
If so, would you please be kind enough to let me know, or direct me to a tutorial on how I can set this up? Thank you very much.
Plugin Author
YOP
(@yourownprogrammer)
Hi DreamsFulfilledAgents,
You can use PHP’s cUrl library to send variables you need. We recommend you to set CURLOPT_RETURNTRANSFER option in order to return response from remote application and not to echo it.
Regards,
YOP Team!
Thank you so much for your reply. I have not heard of that before, and was wondering if you would be kind enough to give me the url of a tutorial on how I can implement this (and even what it is)? Thank you.
would it be easier, or even possible to have the form send the information to two urls?
Plugin Author
YOP
(@yourownprogrammer)
Hey DreamsFulfilledAgents,
Here’s the tutorial you requested:
http://www.php.net/manual/en/curl.examples.php
Regarding your second question, you can send the information to only one url.
Best wishes,
YOP Team
Thank you for the reply. I have looked through the tutorial you gave me. I have been trying all kinds of tings, and just banging my head against the wall. I have even found a number of tutorials, but can’t understand them well enough to implement it.
I’m not seeing on them how I need to split this around the code of the poll. Do I do it like this?
// Get cURL resource
$curl = curl_init();
//YOP POLL lines 2271-2279
// Set some options
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'http://testcURL.com',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => array(
firstName => 'First Name Value',
lastName => 'Last Name Value',
email => 'E-Mail Value'
)
));
// Send the request & save response to $resp
$resp = curl_exec($curl);
// Close request to clear up some resources
curl_close($curl);
Also, I don’t understand how to get the value being sent for the variable firstName to be the value the user enters into the custom field labled ‘First Name’?
Any assistance you can provide will be greatly appreciated. Thanks again.
Plugin Author
YOP
(@yourownprogrammer)
Hi DreamsFulfilledAgents,
Edit yop_poll_model.php and in register_vote() function, approximately on line 2726 add
$custom_field_label_value= array_merge(array($custom_field_base['custom_field']=>$custom_field['custom_field_value']),$custom_field_label_value);
(you’ll have to declare the array first).
The cURL looks ok but in CURLOPT_POSTFIELDS you have to use the array we mentioned above.
Regards,
YOP Team
Hi there,
OK, so I’ve looked at the code, and I don’t see register_vote at line 2726, but I found it at line 2447. Is this the section I need to change?
public function register_vote( $request ) {
global $current_user;
$poll_id = $this->poll['id'];
$unique_id = $this->unique_id;
$location = $request['location'];
if ( wp_verify_nonce( $request['yop-poll-nonce-' . $poll_id . $unique_id], 'yop_poll-' . $poll_id . $unique_id . '-user-actions' ) ){
And, do I add $custom_field_label_value= array_merge(array($custom_field_base['custom_field']=>$custom_field['custom_field_value']),$custom_field_label_value);
after line 2451 that reads:
$location = $request['location'];
or before global $current_user;
But, if I have to declare the array first, don’t I need to do this before line 2271? Or will it still work by delcaring the array at line 2447?
And then, I just leave the cURL function exactly the same as I have above? Or do I change the firstName => 'First Name Value',
etc.?
Thank you again for all your help. I really appreciate it.
Plugin Author
YOP
(@yourownprogrammer)
Hi DreamsFulfilledAgents,
Please email us at yop.help (@] gmail.com and we will provide a .txt file that includes the code with all the modifications.
Regards,
YOP Team