i rewrite the topic because posted in the wrong section.sorry..

Hi,i'm a new user and I found a problem using drupal 6 on my blog.I'm from italy so my english is not perfect..hope i'll be understandable...

After having installed and configured drupal 6 i see that despite i've selected in permissions to anonymous to see,insert and insert without moderation comments,it happens that their comments aren't visible.I see "1 new comment" below the text, and the comment subject in "last comments" block, on the home page... but i don't see the real comment, even in the administration->comments page.A registered user can instead insert comments without any problem.

in content type i've checked comments options.They are ok,enabled,read writebut below:
anonymous comment:
3 options "anonymous can't ,can or must insert information on the contact".are disabled and i can read: "this option is available only when anonymous users have the permission to insert comments il permesso di inviare commenti in the permissions page".This looks like the permission isn't detected despite the flag is checked.

i've installed modules comment module,of course,and image,firestats modules..

someone can help me?thx in advance.

Comments

keff’s picture

I am also experiencing this - I allowed anonymous users to read and write comments, both in user rights and in settings of the 'forum post' content type, but when anonymous users write a comment, it doesn't appear.
However, comments count on that post increases, I can see the post in 'comments' table, and it appears in a 'last comments' sidebar block. But nowhere else, not on the page, nor in admin interface for managing comments.

I have clean drupal install, with just BUeditor on top, but I have installed and uninstalled several other modules (FCKeditor, fivestar, geshi)

keff’s picture

I have now spent 3 hours rebuilding site from scratch - starting from empty installation, installing just BUeditor and poormanscron, and then setting everything up. From the beginning, i tested often,whether anonymous comments show, and they did, so I said it will be OK and set the site up. After that, I tried anonymous comments again, and they stopped showing!!

So this clearly shows that there is a long complicated way to make a nasty bug happen.
And it shouldn't be caused by permissions, as even admin doesn't see them!

Can anyone help, please? Did it happen to someone?

keff’s picture

I dwelved into comment.module and found out a nasty bug - the function comment_render() forgets to take into account comments without owner having uid = 0, so when user with uid = 0 doesn't exist, INNER JOIN doesn't return comments from nonexisting user. - comment.module line 965.

Correct solution: update the queries to have a special case when comment.uid = 0.
Quick fix: add an empty user with uid = 0 into drupal.users table

SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.picture, u.data, c.thread, c.status FROM comments c INNER JOIN users u ON c.uid = u.uid WHERE c.nid = 1 ORDER BY SUBSTRING(c.thread, 1, (LENGTH(c.thread) - 1));

I added the user with uid = 0 and everything is OK, writing bug report now.

keff’s picture

I found the reason - when importing/exporting/copying database, many tools assume that uid>0 and do some unexpected stuff with field whose uid = 0. For example SQLyog I am using assigns the current value of counter instead of 0, thus rewriting anonymous user with uid = 0 into user whose uid = 44 (for 43 users in db), and then all the comments from anonymous will not be shown.

So the final solution is to take care of user with uid = 0 and reset its uid back to 0 when it is changed.

keff’s picture

So it seems that the behaviour is caused by MySQL on MyISQM tables where autoincrement column is expected to begin from 1 and for id=0 the behaviour isn't well defined:
http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html

"Note MySQL's AUTO_INCREMENT behavior for ID=0 cases. (for MyISAM tables, at least).

* Autoincrement starts at 1 by default
* Autoincrement, if applied to a table with existing data (using the ALTER statement) will attempt to overwrite the record with ID=0 and assign that columns value the next AUTO_INCREMENT value."

abu3abdalla’s picture

i need to thank u my dear

mohd nashaat
abu3abdalla@gmail.com
mohdnashaat@msn.com
eng_abu3abdalla@skype
www.tajahdev.com