You are here

function linkit_user_linkit_load_plugins in Linkit 7

Same name and namespace in other branches
  1. 6 plugins/linkit_user/linkit_user.module \linkit_user_linkit_load_plugins()

Implements hook_linkit_load_plugins().

File

plugins/linkit_user/linkit_user.module, line 11
Extend Linkit with user links.

Code

function linkit_user_linkit_load_plugins($string) {
  $matches = array();

  // Get users
  $result = db_select('users', 'u')
    ->fields('u', array(
    'uid',
    'name',
  ))
    ->condition('u.name', '%' . db_like($string) . '%', 'LIKE')
    ->condition('u.status', '1')
    ->execute();
  foreach ($result as $user) {
    $matches['user'][] = array(
      'title' => $user->name,
      'path' => 'user/' . $user->uid,
      'information' => array(
        'type' => 'User',
      ),
    );
  }
  return $matches;
}