Hi all,

thank you for a great module! I'm using 6-2-beta3 and came across something that I think is wrong, but maybe I don't understand the concept here. If I post a comment, the last_comment_name doesn't get set the way I would expect. Changing Line 1004 in nodecomment.module to "$last_reply->name," fixed the issue for me, because now the node_comment_statistics tabel gets updated the way I expect it to. I'm using node comments for a forum, and seeing who made the last reply is crucial here. Btw I didn't find the link to the dev version, so I didn't check if this was taken care of yet.

Thanks and keep up the good work

Dave

Comments

crea’s picture

Status: Active » Postponed (maintainer needs more info)

As far as I see we are repeating core comment module which does the same:

$last_reply = db_fetch_object(db_query_range('SELECT cid, name, timestamp, uid FROM {comments} WHERE nid = %d AND status = %d ORDER BY cid DESC', $nid, COMMENT_PUBLISHED, 0, 1));
db_query("UPDATE {node_comment_statistics} SET comment_count = %d, last_comment_timestamp = %d, last_comment_name = '%s', last_comment_uid = %d WHERE nid = %d", $count, $last_reply->timestamp, $last_reply->uid ? '' : $last_reply->name, $last_reply->uid, $nid);

crea’s picture

Category: bug » support

See comment of the _comment_update_node_statistics() function:

last_comment_name: the name of the anonymous poster for the last comment

huesforalice’s picture

ok got it, thanks for your replies. where would I get the name of the last poster of a comment that is authenticated then?

crea’s picture

Status: Postponed (maintainer needs more info) » Fixed

user_load() by last reply uid or run direct select query manually.

huesforalice’s picture

hm well as far as I can see my node object does not specify a last reply uid, or would I need to retrieve that via an api call or a database lookup?

crea’s picture

I don't know if the ready-to-use api call exists for this. As you can see from quoted piece of code, last reply uid is in the node_comment_statistics table.

huesforalice’s picture

Ok right, then that's what I'll use. Thanks again crea.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.