| 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.
$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.
<?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;
}
?>