Hi! Just installed adv forum. Everything seams to work great except at the forum list, where I get this as latest comment at the forumlist:
Jajamen ...
3 tim 30 min ago
by Anonymous
in Manuell ...

the problem is "Anonymous", it is a registered user that posted the comment and the username is shown inside the forum at the topiclist. So only at the forumlist author is shown as anonymous even though it is not anonomous. Please anyone know what is the problem?

Comments

psicomante’s picture

It happened also to me. I think it was a cache problem, because i changes user name. Could is this the problem?

kjpil’s picture

cheers man, but is this tables in the database I need to clear?
I ran this code but it didnt sort out the issue :/

echo "This page runs a script that clears the main cache.
";
$sql = "DELETE from cache WHERE 1";
$result = mysql_query($sql);
echo "It's clear now.
";

swirt’s picture

I am seeing the same problem. It appeared after updating from Drupal 6.2 to 6.3 and updating advanced_forum to the most recent release.

kjpil’s picture

<?
echo "This page runs a script that clears the main cache.
";
db_query("DELETE FROM {cache} WHERE 1");
db_query("DELETE FROM {cache_filter} WHERE 1");
db_query("DELETE FROM {cache_menu} WHERE 1");
db_query("DELETE FROM {cache_page} WHERE 1");
echo "It's clear now.
";
?>

I ran this code as well, but still it does not work :(

memenode’s picture

I'm having the same problem using alpha10 on Drupal 5.8, just upgraded from 4.7.

On another site where I am using alpha8 it doesn't happen though.

I'm wondering if changes associated with this have anything to do with it: http://drupal.org/node/268273

Cheers

jwilson3’s picture

I'm seeing the same problem after installing adv_forum alpha10 on Drupal 5.7

Haven't tried clearing cache yet, but will and get back on here with an update...

I'm gonna have a look at a couple of patches that supposedly fixed or improved performance on this whole business with last post (ie, reply)

http://drupal.org/node/268273#comment-892960

maybe that will get me headed in the right direction.

jwilson3’s picture

Status: Active » Needs review

change "topic_author_id" to "reply_author_id" in the query around line 877 in sites/all/modules/advanced_forum/advanced_forum.module

original code inside function _advanced_forum_get_last_topic():

...
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,
...  

my change:

...
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 AS reply_author_id,
 ...

Disclaimer: I had also applied the patch mentioned ^^ and thus this one liner isn't tested with plain old alpha10

heres my entire version of _advanced_forum_get_last_topic() with forementioned patch applied and comments cleaned out:

function _advanced_forum_get_last_topic($tid) {
  // 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 AS topic_author_id
            FROM {node} n
            INNER JOIN {term_node} tn on n.nid = tn.nid
            WHERE n.type = 'forum' AND
                  n.status = 1 AND
                  tn.tid = %d
            ORDER BY n.created DESC
            LIMIT 1 ";
  $node = db_fetch_object(db_query($query, $tid));

  // If there is a 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 AS 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 c.timestamp > %d
                AND c.status = 0
                AND tn.tid = %d
                AND n.status = 1
                AND c.status = 0
              ORDER BY c.timestamp DESC
              limit 1";
    $comment = db_fetch_object(db_query($query, $node->topic_timestamp, $tid));

    if($comment){
      $comment->tid = $tid;
      return $comment;
    }else{
      $query = "SELECT u.name AS topic_author_name
                FROM {users} u
                WHERE u.uid = %d";
      $username = db_result(db_query($query, $node->topic_author_id));
      $node->reply_id = 0;
      $node->topic_author_name = $username;
      return $node;
    }
  }
}

and apply the index on comments.timestamp

ALTER TABLE drp_comments ADD INDEX ( `timestamp` )

michelle’s picture

Status: Needs review » Closed (duplicate)
memenode’s picture

Thanks jrguitar21, that seems to work.