You are here

function favorites_load_favorites in Favorites 6

Same name and namespace in other branches
  1. 7.2 favorites.module \favorites_load_favorites()
  2. 7 favorites.module \favorites_load_favorites()

Load the favorites for a particular user.

1 call to favorites_load_favorites()
favorites_list in ./favorites.module
Generate the "My Favorites" list.

File

./favorites.module, line 274
The favorites module allows users to bookmark any path within a site.

Code

function favorites_load_favorites($uid = 0) {
  $favorites = array();
  if ($uid) {
    $query = db_query("SELECT * FROM {favorites} WHERE uid = %d ORDER BY timestamp DESC", $uid);
    while ($favorite = db_fetch_object($query)) {
      $favorite->token = favorite_token($favorite);
      $favorite->path = drupal_get_path_alias($favorite->path);
      $favorites[] = $favorite;
    }
  }
  return $favorites;
}