This is a minor bug in version 6.x-alpha2 version.
It's created by this lines: (function: function advanced_forum_preprocess_forum_submitted(&$variables) )
// Format the author of the last post (node or comment)
$author = new stdClass();
if (!empty($variables['topic']->reply_author_id)) {
$author->uid = $variables['topic']->reply_author_id;
$author->name = $variables['topic']->reply_author_name;
}
else {
$author->uid = $variables['topic']->topic_author_id;
$author->name = $variables['topic']->topic_author_name;
}
Why? Because the 'topic' variable doesn't has the reply_author_id, then, they show the username "Anonymous".
To fix it, i change the SQL for give the reply_author_id(i think that are a simply mistake :D) function: function _advanced_forum_get_last_topic($tid)
This is the original
// Get the most recently created node, in the given forum, that the user has access to
$query = "SELECT n.nid AS topic_id,
n.title AS topic_title,
n.created AS topic_timestamp,
n.type AS topic_type,
n.uid topic_author_id,
u.name AS topic_author_name
FROM {node} n
INNER JOIN {term_node} tn on n.nid = tn.nid
INNER JOIN {users} u on n.uid = u.uid
WHERE tn.tid = $tid AND n.status = 1
ORDER BY n.created DESC";
$node = db_fetch_object(db_query_range(db_rewrite_sql($query), array(), 0, 1));
// If there is at least one node, then we need to look for the most recent comment
if ($node) {
$query = "SELECT c.nid AS topic_id,
c.cid AS reply_id,
c.timestamp AS reply_timestamp,
c.subject AS reply_title,
c.uid topic_author_id,
n.title AS topic_title,
n.created AS topic_timestamp,
n.type AS topic_type,
c.name AS reply_author_name
FROM {comments} c
INNER JOIN {term_node} tn ON c.nid = tn.nid
INNER JOIN {node} n ON c.nid = n.nid
WHERE tn.tid = $tid AND n.status = 1 AND c.status = 0
ORDER BY c.timestamp DESC";
i change the 2º query, and change c.uid topic_author_id, for c.uid reply_author_id, then, it show similar to:
// Get the most recently created node, in the given forum, that the user has access to
$query = "SELECT n.nid AS topic_id,
n.title AS topic_title,
n.created AS topic_timestamp,
n.type AS topic_type,
n.uid topic_author_id,
u.name AS topic_author_name
FROM {node} n
INNER JOIN {term_node} tn on n.nid = tn.nid
INNER JOIN {users} u on n.uid = u.uid
WHERE tn.tid = $tid AND n.status = 1
ORDER BY n.created DESC";
$node = db_fetch_object(db_query_range(db_rewrite_sql($query), array(), 0, 1));
// If there is at least one node, then we need to look for the most recent comment
if ($node) {
$query = "SELECT c.nid AS topic_id,
c.cid AS reply_id,
c.timestamp AS reply_timestamp,
c.subject AS reply_title,
c.uid reply_author_id,
n.title AS topic_title,
n.created AS topic_timestamp,
n.type AS topic_type,
c.name AS reply_author_name
FROM {comments} c
INNER JOIN {term_node} tn ON c.nid = tn.nid
INNER JOIN {node} n ON c.nid = n.nid
WHERE tn.tid = $tid AND n.status = 1 AND c.status = 0
ORDER BY c.timestamp DESC";
Sorry, i'm spanish and my english is too bad :(. I think that i place the "options" for this issue correctly, of course, you can modify it if they are wrong.
Comments
Comment #1
Eleazan commentedsorry -> http://drupal.org/node/294205
Comment #2
Thoor commentedThanks a lot for this help here!
It helped me well, by fixing my problem.
Comment #3
stevinium commentedThis helped me fix the problem.
I just changed
c.uid topic_author_id,
to
c.uid reply_author_id,
Thanks,
Steve