it seems as if the module does not store the name for anonymous users
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | nodecomment_anonymous_name.patch | 531 bytes | Narretz |
| #14 | nodecomment_280308.patch | 465 bytes | crea |
| #5 | nodecomment_validation_234501.patch | 1.62 KB | sirkitree |
Comments
Comment #1
sirkitree commenteduh, yeah. what? anonymous users don't have names in Drupal...
Comment #2
idealista commentedThey 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.
Comment #3
pearcec@drupal.org commentedI verified this, it just leaves the field empty in the row.
Comment #4
idealista commentedif i get info on where to look, i'll try to create a patch..
Comment #5
sirkitree commentedtry this patch
Comment #6
wwwoliondorcom commentedHi,
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!
Comment #7
sedmi commentedI have the same problem with version 6.x-2.0-beta1
Comment #8
voidfiles commentedI can confirm this, and I can't see how the patch would work.
Comment #9
voidfiles commentedOkay 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.
Comment #10
cjs_ commentedI can confirm this fix works.
Comment #11
idealista commentedi can confirm this also works for 6.x-1.2-rc2, although the change is around line 470 in function nodecomment_save
Comment #12
Narretz commentedThis works, thx
the original comment modules uses this:
&& isset($user->name)
Comment #13
crea commented$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.
Comment #14
crea commentedPlease try this patch. During my brief testing it doesn't break anything.
Comment #15
Narretz commented(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:
Comment #16
crea commented@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
Comment #17
Narretz commentedI 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.
Comment #18
crea commentedI apologize if I offended you. I have limited resources and I'm here to fix bugs, not to teach people.
Comment #19
crea commentedCommitted the patch in #14