You are here

function sbp_users_sbp_details in Search by Page 7

Same name and namespace in other branches
  1. 6 sbp_users.module \sbp_users_sbp_details()

Implements Search by Page hook_sbp_details().

Returns details for a particular user ID, for particular search keys.

File

./sbp_users.module, line 117
Module file for Search by Page Users, a sub-module for Search by Page.

Code

function sbp_users_sbp_details($id, $environment, $keys = NULL) {
  $id = intval($id);
  if (!$id) {
    return NULL;
  }
  $user = user_load($id, TRUE);
  if (!$user->name) {
    return NULL;
  }

  // Get basic user info
  $ret = array(
    'type' => t('User'),
    'title' => check_plain($user->name),
    'object' => $user,
  );

  // Get snippet from stored page data.
  if ($keys) {
    $content = search_by_page_stored_page_content('sbp_users', $id, $environment);
    if ($content) {
      $ret['snippet'] = search_by_page_excerpt($keys, $content);
    }
  }
  return $ret;
}