You are here

function content_profile_load in Content Profile 6

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.

12 calls to content_profile_load()
content_profile_action_load in ./content_profile.rules.inc
Loads a Content Profile
content_profile_help in ./content_profile.module
Implementation of hook_help().
content_profile_node_from_user_ctools_context in panels/relationships/node_from_user.inc
Return a new context based on an existing context.
content_profile_page_access in ./content_profile.module
content_profile_page_edit in ./content_profile.module
Presents a node editing or adding form for the given content profile.

... See full list

File

./content_profile.module, line 474

Code

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;
}