it seems as if the module does not store the name for anonymous users

Comments

sirkitree’s picture

uh, yeah. what? anonymous users don't have names in Drupal...

idealista’s picture

They dont have names unless they specify one when submitting a comment.
As an anonymous user, you get a form with Name, Email and Homepage. Thats the name that isn't getting stored in the db.

pearcec@drupal.org’s picture

I verified this, it just leaves the field empty in the row.

idealista’s picture

if i get info on where to look, i'll try to create a patch..

sirkitree’s picture

Status: Active » Needs review
StatusFileSize
new1.62 KB

try this patch

wwwoliondorcom’s picture

Hi,

Does the patch works? I also have the same problem, the anonymous commenter name is stored in the admin but it doesn't show up on the node page where the comment has been written.

Also, the website information that the user write is never showed.

Thanks for help!

sedmi’s picture

Version: 5.x-1.1 » 6.x-2.0-beta1

I have the same problem with version 6.x-2.0-beta1

voidfiles’s picture

Version: 6.x-2.0-beta1 » 6.x-2.0-beta3

I can confirm this, and I can't see how the patch would work.

voidfiles’s picture

Okay so this is how I fixed it but I am not sure how to make a patch.

Around line 640 in nodecomment.module

There is this

if ($node->uid === $user->uid) { // '===' because we want to modify anonymous users too
$node->name = $user->name;
}

The problem with this is that if the node is created by and anonymouse user, and the user is anonymous the $node->name gets assigned a NULL because the anonymouse $user has no name.

So I just change it to this

if ($node->uid === $user->uid && $user->uid != 0) { // '===' because we want to modify anonymous users too
$node->name = $user->name;
}

If the user is anonymous just use the name the user passed in.

cjs_’s picture

I can confirm this fix works.

idealista’s picture

Status: Needs review » Reviewed & tested by the community

i can confirm this also works for 6.x-1.2-rc2, although the change is around line 470 in function nodecomment_save

Narretz’s picture

This works, thx

the original comment modules uses this:

&& isset($user->name)

crea’s picture

$node->name should always be set to something meaningful since it's a node, and every node has an author. I can commit described change, but we really should investigate if we need this code block at all.

crea’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new465 bytes

Please try this patch. During my brief testing it doesn't break anything.

Narretz’s picture

Version: 6.x-2.0-beta3 » 6.x-2.x-dev
StatusFileSize
new531 bytes

(changed version to 6.x-2.x-dev)

The patch doesn't break anything, but it doesn't fix the issue either.
When submitting an anonymous comment, the name chosen by the anonymous user (guest) won't be stored in the database, and is therefore not shown toegther with the comment.

The code block is necessary; I think the easiest thing is to do it the same way as the comment.module, modified for node comments. Turns out we don't need $node->name, which leaves us with this:

crea’s picture

@Narretz
During my brief testing anonymous name was stored successfully and your patch doesn't make sense. Please don't submit patches if you don't understand PHP

Narretz’s picture

I retested your patch and it works; probably a cache thing. My php isn't very good, that is true; but thankfully we have patch reviews to correct that. I'm not learning from "Please don't submit patches if you don't understand PHP" though.

crea’s picture

I apologize if I offended you. I have limited resources and I'm here to fix bugs, not to teach people.

crea’s picture

Status: Needs review » Fixed

Committed the patch in #14

Status: Fixed » Closed (fixed)

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