aboutsummaryrefslogtreecommitdiffstats
path: root/comments.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2009-07-16 05:20:34 +0000
committerrvelices <rv-github@modusoptimus.com>2009-07-16 05:20:34 +0000
commite618e8b944bc734defa22619a8826a55067d5911 (patch)
treeedbd1746ca7f98cd741f56485480dabf9c9111a7 /comments.php
parentc57fa7e7e3fce583eabab81b2857f95189969bd6 (diff)
- 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) git-svn-id: http://piwigo.org/svn/trunk@3600 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--comments.php22
1 files changed, 2 insertions, 20 deletions
diff --git a/comments.php b/comments.php
index 3570a6e53..d1609fdea 100644
--- a/comments.php
+++ b/comments.php
@@ -87,7 +87,7 @@ if (isset($_GET['items_number']))
{
$page['items_number'] = $_GET['items_number'];
}
-if ( !is_numeric($page['items_number']) and $page['items_number']!='all' )
+if ( !is_numeric($page['items_number']) and $page['items_number']!='all' )
{
$page['items_number'] = 10;
}
@@ -271,8 +271,6 @@ SELECT COUNT(DISTINCT(com.id))
FROM '.IMAGE_CATEGORY_TABLE.' AS ic
INNER JOIN '.COMMENTS_TABLE.' AS com
ON ic.image_id = com.image_id
- LEFT JOIN '.USERS_TABLE.' As u
- ON u.'.$conf['user_fields']['id'].' = com.author_id
WHERE '.implode('
AND ', $page['where_clauses']).'
;';
@@ -304,15 +302,12 @@ SELECT com.id AS comment_id
, ic.category_id
, com.author
, com.author_id
- , '.$conf['user_fields']['username'].' AS username
, com.date
, com.content
, com.validated
FROM '.IMAGE_CATEGORY_TABLE.' AS ic
INNER JOIN '.COMMENTS_TABLE.' AS com
ON ic.image_id = com.image_id
- LEFT JOIN '.USERS_TABLE.' AS u
- ON u.'.$conf['user_fields']['id'].' = com.author_id
WHERE '.implode('
AND ', $page['where_clauses']).'
GROUP BY comment_id
@@ -378,25 +373,12 @@ SELECT id, name, permalink, uppercats
)
);
- if (!empty($comment['author']))
- {
- $author = $comment['author'];
- if ($author == 'guest')
- {
- $author = l10n('guest');
- }
- }
- else
- {
- $author = $comment['username'];
- }
-
$tpl_comment =
array(
'U_PICTURE' => $url,
'TN_SRC' => $thumbnail_src,
'ALT' => $name,
- 'AUTHOR' => trigger_event('render_comment_author', $author),
+ 'AUTHOR' => trigger_event('render_comment_author', $comment['author']),
'DATE'=>format_date($comment['date'], true),
'CONTENT'=>trigger_event('render_comment_content',$comment['content']),
);