/[drupal]/contributions/modules/favorite_nodes/favorite_nodes.module
ViewVC logotype

Diff of /contributions/modules/favorite_nodes/favorite_nodes.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.8.2.9, Fri Jan 9 04:01:09 2009 UTC revision 1.8.2.10, Sat Mar 28 16:19:49 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: favorite_nodes.module,v 1.8.2.8 2008/09/29 16:46:00 kbahey Exp $  // $Id: favorite_nodes.module,v 1.8.2.9 2009/01/09 04:01:09 kbahey Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 140  function favorite_nodes_user($op, &$edit Line 140  function favorite_nodes_user($op, &$edit
140    
141    switch ($op) {    switch ($op) {
142      case 'view':      case 'view':
       $user->content['faveliste'] = array(  
         '#type' => 'user_profile_category',  
         '#title' => t('My favorites'),  
         '#value' => theme('item_list', $items),  
       );  
143        $fav_list = array();        $fav_list = array();
144        foreach (_node_types_natcasesort() as $type) {        foreach (_node_types_natcasesort() as $type) {
145          if (variable_get(FAVORITE_NODES_NODE_TYPE . $type->type, 0)) {          if (variable_get(FAVORITE_NODES_NODE_TYPE . $type->type, 0)) {
146            $uid = intval($user->uid);            $uid = intval($user->uid);
147            $favorites = favorite_nodes_get($uid, $type->type, variable_get(FAVORITE_NODES_BLOCK_LIMIT, 5));            $favorites = favorite_nodes_get($uid, $type->type, variable_get(FAVORITE_NODES_PROFILE_LIMIT, 5));
148            $items = array();            $items = array();
149            if (!empty($favorites)) {            if (!empty($favorites)) {
150                $user->content['favorite_nodes_list'] = array(
151                  '#type' => 'user_profile_category',
152                  '#title' => t('My favorites'),
153                );
154              foreach ($favorites as $favorite) {              foreach ($favorites as $favorite) {
155                $items[] = l($favorite->title, "node/$favorite->nid");                $items[] = l($favorite->title, "node/$favorite->nid");
156              }              }
# Line 496  function favorite_nodes_get($uid, $type Line 495  function favorite_nodes_get($uid, $type
495      $limit = variable_get(FAVORITE_NODES_PAGE_LIMIT, 10);      $limit = variable_get(FAVORITE_NODES_PAGE_LIMIT, 10);
496    }    }
497    $row = array();    $row = array();
498    if ($type && variable_get(FAVORITE_NODES_NODE_TYPE . $type, 0)) {    if ($limit != 0 && $type && variable_get(FAVORITE_NODES_NODE_TYPE . $type, 0)) {
499      $sql = "SELECT n.nid, n.title, f.uid, f.last FROM {node} n INNER JOIN {favorite_nodes} f ON n.nid = f.nid WHERE n.type = '%s' AND f.uid = %d ORDER by f.last DESC";      $sql = "SELECT n.nid, n.title, f.uid, f.last FROM {node} n INNER JOIN {favorite_nodes} f ON n.nid = f.nid WHERE n.type = '%s' AND f.uid = %d ORDER by f.last DESC";
500      $sql_count = "SELECT COUNT(*) FROM {node} n INNER JOIN {favorite_nodes} f ON n.nid = f.nid WHERE n.type = '%s' AND f.uid = %d";      $sql_count = "SELECT COUNT(*) FROM {node} n INNER JOIN {favorite_nodes} f ON n.nid = f.nid WHERE n.type = '%s' AND f.uid = %d";
501    

Legend:
Removed from v.1.8.2.9  
changed lines
  Added in v.1.8.2.10

  ViewVC Help
Powered by ViewVC 1.1.2