content_profile_load

6 content_profile.module content_profile_load($type, $uid, $lang = '', $reset = NULL)

Loads the node, like node_load but makes sure the results are cached.

Parameters

$type: The content profile's type.

$uid: The profile owner's user id.

$lang: Optional. If translation is enabled, the language of the profile to return.

$reset: Optional. If set, the cache is reset.

13 functions call content_profile_load()

File

contributions/content_profile/content_profile.module, line 474
Marks content types as profiles.

Code

<?php
function content_profile_load($type, $uid, $lang = '', $reset = NULL) {
  static $cache = array();

  if (!isset($cache[$type][$uid][$lang]) || $reset) {
    $cache[$type][$uid][$lang] = FALSE;
    $params = array(
      'type' => $type,
      'uid' => $uid,
    );
    if ($node = node_load($lang ? $params + array('language' => $lang) : $params, NULL, $reset)) {
      $cache[$type][$uid][$lang] = $node->nid;
    }
    return $node;
  }
  return !empty($cache[$type][$uid][$lang]) ? node_load($cache[$type][$uid][$lang]) : FALSE;
}
?>