Changeset 3600 for trunk/comments.php


Ignore:
Timestamp:
Jul 16, 2009, 7:20:34 AM (15 years ago)
Author:
rvelices
Message:
  • fix php warning from comment_list.tpl
  • author name is saved always in #comments (even for registered users) so that
    • sql queries are simpler on the comments page (one less table in a big join)
    • when a user is deleted, we can keep the username in the #comments (there might be still a bug that author_id is not updated when a user is deleted)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/comments.php

    r3520 r3600  
    8888  $page['items_number'] = $_GET['items_number'];
    8989}
    90 if ( !is_numeric($page['items_number']) and $page['items_number']!='all' ) 
     90if ( !is_numeric($page['items_number']) and $page['items_number']!='all' )
    9191{
    9292  $page['items_number'] = 10;
     
    272272    INNER JOIN '.COMMENTS_TABLE.' AS com
    273273    ON ic.image_id = com.image_id
    274     LEFT JOIN '.USERS_TABLE.' As u
    275     ON u.'.$conf['user_fields']['id'].' = com.author_id
    276274  WHERE '.implode('
    277275    AND ', $page['where_clauses']).'
     
    305303     , com.author
    306304     , com.author_id
    307      , '.$conf['user_fields']['username'].' AS username
    308305     , com.date
    309306     , com.content
     
    312309    INNER JOIN '.COMMENTS_TABLE.' AS com
    313310    ON ic.image_id = com.image_id
    314     LEFT JOIN '.USERS_TABLE.' AS u
    315     ON u.'.$conf['user_fields']['id'].' = com.author_id
    316311  WHERE '.implode('
    317312    AND ', $page['where_clauses']).'
     
    379374          );
    380375
    381     if (!empty($comment['author']))
    382     {
    383       $author = $comment['author'];
    384       if ($author == 'guest')
    385       {
    386         $author = l10n('guest');
    387       }
    388     }
    389     else
    390     {
    391       $author = $comment['username'];
    392     }
    393 
    394376    $tpl_comment =
    395377      array(
     
    397379        'TN_SRC' => $thumbnail_src,
    398380        'ALT' => $name,
    399         'AUTHOR' => trigger_event('render_comment_author', $author),
     381        'AUTHOR' => trigger_event('render_comment_author', $comment['author']),
    400382        'DATE'=>format_date($comment['date'], true),
    401383        'CONTENT'=>trigger_event('render_comment_content',$comment['content']),
Note: See TracChangeset for help on using the changeset viewer.