Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author zaus

    (@zaus)

    You should be able to make one form and pre-populate a (hidden?) field with the currently logged in user, or write a hook to attach it to the plugin submission, or just have an extra text field and ask the user to put in their username.

    If you need help writing a hook look at my Dynamic Fields plugin, since that’s basically doing something similar.

    Thread Starter kkmarch7

    (@kkmarch7)

    Hi and thank you for your response. The user would not be logged in so that is where I am having trouble. Our website has a listing of Real Estate gaents. Each Agent has a profile which is a post. The contact form would be on each post. When someone visiting the website wants to contact the real estate agent they located via the website they would fill in the contact form. The third party I am pushing to would need to identify whom to push it to based on which profile/post it came from. Can I attach the username to the post? Or is this still something I can do with a hook? Thank you again.

    Plugin Author zaus

    (@zaus)

    Oh I get it. Same thing should apply, just populate it with the user profile from the page you’re on (wp should have some variable or function to get it). Or if you have control over the url, the easy way would be to have their user name in the query string (like ‘mysite.com/contact?agent=person1’) and then you can use my Dynamic Fields plugin with ##GET{agent}##, or any other form-plugin specific way to use a GET param.

    Thread Starter kkmarch7

    (@kkmarch7)

    Hi and thank you for this information. I added the username to the post as a custom field. Then using the Contact Form 7 – Dynamic Text Extension plugin I was able to add the username via form tag with hidden CF7_get_post_var key=’se_username’

    The third party CRM I am working with provided me with the following code as an example: Originally User ID was going to be used but it has been changed to username.

    Would the submission URL be $host?

    <?php
    
    // BEGIN FORM HANDLER
    
    function createSELead($params=array()){
    	$host = 'https://salesengine.se/WebServices/Post/?user_id='.(int)$params['user_id'].'&rec_type_id='.(int)$params['rec_type_id'].'&rec_status_id='.(int)$params['rec_status_id'];
    	$post = http_build_query($params);
    	$c = curl_init($host);
    	curl_setopt($c, CURLOPT_HEADER, 0);
    	curl_setopt($c, CURLOPT_USERPWD, "se:webservices");
    	curl_setopt($c, CURLOPT_TIMEOUT, 30);
    	curl_setopt($c, CURLOPT_POST, 1);
    	curl_setopt($c, CURLOPT_POSTFIELDS, $post);
    	curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
    	$return = curl_exec($c);
    	curl_close($c);
    	return $return;
    }
    
    $action = '';
    if (isset($_POST['action'])) $action = $_POST['action'];
    
    if ($action == 'process') {
    
    	$params = array(
    		'user_id'=>31060, // SE User ID
    		'rec_type_id'=>558, // Lead
    		'rec_status_id'=>177549, // New Lead
    		'source'=>'Website form - whatever you want here',
    		'person_first_name'=>$_POST['person_first_name'],
    		'person_middle_name'=>$_POST['person_middle_name'],
    		'person_last_name'=>$_POST['person_last_name'],
    		'person_birthdate'=>$_POST['person_birthdate_day']."-".$_POST['person_birthdate_month']."-".$_POST['person_birthdate_year'],
    		'person_spouse_first_name'=>$_POST['person_spouse_first_name'],
    		'person_spouse_last_name'=>$_POST['person_spouse_last_name'],
    		'person_birthdate'=>$_POST['person_birthdate_spouse_day']."-".$_POST['person_birthdate_spouse_month']."-".$_POST['person_birthdate_spouse_year'],
    		'person_company_name'=>$_POST['person_company_name'],
    		'person_primary_phone'=>$_POST['person_primary_phone'],
    		'person_primary_email'=>$_POST['person_primary_email'],
    		'person_address1'=>$_POST['person_address1'],
    		'person_address2'=>$_POST['person_address2'],
    		'person_city'=>$_POST['person_city'],
    		'person_state'=>$_POST['person_state'],
    		'person_zip'=>$_POST['person_city'],
    		'person_country'=>$_POST['person_country']
    	);
    
    	$response = createSELead($params);
    
    	echo '<textarea style="height:300px; width:100%">';
    	print_r($response);
    	echo '</textarea>';
    
    	echo "<p>Do what you wish with the above response, and URL forward to the Calculator.</p>";
    
    	exit;
    }
    
    // END FORM HANDLER

    I have created the appropriate mapping utilizing the info above. I have also clicked the debugging option but I am not receiving the debug email, any idea what this could be?

    Thank you for your time.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Multiple Contacts’ is closed to new replies.