function eloqua_post_create in Eloqua 7.2
Same name and namespace in other branches
- 6 eloqua.inc \eloqua_post_create()
- 7 eloqua_webform/eloqua_webform.inc \eloqua_post_create()
Creates a post into the database.
@hook eloqua_post_create
Parameters
object $post: The post object.
Return value
int The post ID.
1 call to eloqua_post_create()
- eloqua_webform_submit in eloqua_webform/
eloqua_webform.module - Form submission handler for eloqua_admin_form().
File
- eloqua_webform/
eloqua_webform.inc, line 242 - Eloqua Helper functions and constants
Code
function eloqua_post_create($post) {
if (!is_object($post)) {
$type = gettype($post);
watchdog('eloqua', 'Invalid argument sent to !module_name (!type).', array(
'!module_name' => __FUNCTION__,
'!type' => $type,
));
return FALSE;
}
$fields = array(
'form_id' => $post->{'form_id'},
'post_time' => $post->{'post_time'},
'status' => $post->{'status'},
'data' => serialize($post->{'data'}),
);
$result = db_insert('eloqua_saved_posts')
->fields($fields)
->execute();
// The result must be the post_id or we'll end up with duplicate records in
// the eloqua_saved_posts table.
if ($result === FALSE || $result === NULL) {
$result = FALSE;
}
if (!$result) {
// If unable to create the payment plan, end.
return FALSE;
}
$post->{'post_id'} = $result;
foreach (module_implements('eloqua_post_create') as $module_name) {
$method = $module_name . '_eloqua_post_create';
$method($post);
}
_eloqua_post_update($post);
return $post;
}