You are here

function eloqua_post_load in Eloqua 7.2

Same name and namespace in other branches
  1. 6 eloqua.inc \eloqua_post_load()
  2. 7 eloqua_webform/eloqua_webform.inc \eloqua_post_load()

Loads a post form the database.

@hook eloqua_post_load ($post)

Parameters

int $post_id: The post ID.

Return value

object The post object.

File

eloqua_webform/eloqua_webform.inc, line 202
Eloqua Helper functions and constants

Code

function eloqua_post_load($post_id) {

  // Get the raw result from the DB.
  if (!is_numeric($post_id)) {
    $type = gettype($post_id);
    watchdog('eloqua', 'Invalid argument sent to !module_name (!type).', array(
      '!module_name' => __FUNCTION__,
      '!type' => $type,
    ), WATCHDOG_DEBUG);
    return NULL;
  }
  $result_set = db_select('eloqua_saved_posts')
    ->condition('post_id', $post_id)
    ->execute()
    ->fetchAll();
  $result = _eloqua_unserialize_data_column($result_set);
  $post = array_shift($result);
  if (empty($post)) {
    return NULL;
  }

  // Send the object around to all of its friends.
  foreach (module_implements('eloqua_post_load') as $module_name) {
    $method = $module_name . '_eloqua_post_load';
    $method($post);
  }
  return $post;
}