function salesforce_contact_form in Salesforce Suite 5
handle the contact form in a special way since we're building the $user object manually from the contact form values
File
- ./
salesforce.module, line 256 - Original Creator, Maintainer & Developer: Steve McKenzie (http://drupal.org/user/45890) Drupal and Salesforce.com (mainly only working with contacts / leads but can be extended to do anything the salesforce API version 6 can do) Current…
Code
function salesforce_contact_form($form_id, $form_values) {
global $user;
if ($user->uid > 0) {
$account->uid = $user->uid;
}
$name = explode(' ', $form_values['name']);
$k = count($name);
$fname = '';
// Concatenate first names if any
if ($k > 1) {
for ($i = 0; $i < $k - 1; $i++) {
$fname .= $i > 0 ? ' ' . $name[$i] : $name[$i];
}
$account->first_name = $fname;
$account->last_name = $name[$k - 1];
}
else {
$account->first_name = $form_values['name'];
$account->last_name = $form_values['name'];
}
$account->company = 'n/a';
$account->mail = $form_values['mail'];
$result = salesforce_lead('insert', $account, array(
'Description' => t('contact us form with the subject: @subject', array(
'@subject' => $form_values['subject'],
)),
));
}