Closed (fixed)
Project:
Drupal core
Version:
x.y.z
Component:
node system
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Jan 2006 at 13:04 UTC
Updated:
23 Mar 2006 at 22:15 UTC
Jump to comment: Most recent file
Comments
Comment #1
Steve Dondley commentedI traced this problem back to the database. The "name" field for user 0 is blank.
Comment #2
Steve Dondley commentedIgnore last post. It's blank for versions 4.6, too.
Comment #3
Steve Dondley commentedHere's a patch.
Comment #4
Steve Dondley commentedOne other thing: the patch at http://drupal.org/node/42955 will need to be applied before testing this.
Comment #5
killes@www.drop.org commentedlooks good to me.
Comment #6
Cvbge commentedI think your solution needs also a updates.inc function to update 4.6 anonymous posts?
Comment #7
chx commentedNo, because in case there is no $node->name , anonymous is filled in. This is elegant and needed.
Comment #8
dries commentedComment #9
Cvbge commentedI'm affraid this does not work.
I tried to move a forum topic created by anonymous. The author name was correctly set to "Anonim" (I've translated the 'anonymous' to 'Anonim' somewhere in the admin/ settings).
I've pressed 'preview' but an error appeared: "user name Anonim does not exists" (or similar - was translated).
Comment #10
Cvbge commentedThe reason is that uid 0 does not have name set in the database. The name for uid 0 is kept as variable, and the code checks
if (!empty($node->name) && !($account = user_load(array('name' => $node->name)))) {This could be fixed by either moving anonymous name to the database or adding check for the anonymous name explicitly in the shown code.
Comment #11
Steve Dondley commentedThe new bug at http://drupal.org/node/43579 needs to be fixed before this one can be debugged.
Comment #12
Cvbge commentedThe mentioned bug was fixed.
Now the patch: $account is not used, removed. Fixed the bug by comparing against anonymous also.
I've tested it, and consider this to be RTBC.
Comment #13
Steve Dondley commentedWhat's RTBC? Can't even find it on Google.
Comment #14
Cvbge commentedpatch (Ready To Be Committed) ;)
Comment #15
dries commentedIf we may believe the code comment below the line you changed, the empty string denotes the anonymous user. Something might still be out of whack?
Comment #16
Cvbge commentedIf that's the case then other parts (comment.module and form generation?) should be changed not to set Authored by to 'Anonymous' but leave it empty.
Comment #17
Cvbge commentedI tried changing it so the user name is not filled (left blank) for anonymous authors. But in that case the validation (done by fapi) fails because author field is required.
Attached patch removes 'reguired' flag from Authored by field and sets it to '' (empty string) if author is anonymous. Also adds a description explaining to use empty string to denote Anonymous.
Please review.
Comment #18
eafarris commentedLast patch still applies (with offsets), and works as advertised.
I'm not sure this is the right solution, though. By removing the requirement that a forum post has an author, we now allow the ability for roles with "edit own forum topic" to blank out the author field, changing a post to anonymous.
If this behavior is acceptable, this is RTBC.
Comment #19
Cvbge commentedI don't think it's acceptable.
Users with "edit own ..." (forum, posts, etc) should not have possibility to edit the author field - either it should not be in a form, or it should not be editable. If it is editable, then IMO it's a bug and should be changed.
Comment #20
Cvbge commentedI've looked over the code and it doesn't look like it's possibile for users with "edit own posts" permission to change the author. I've tried to create/edit page and forum node as such user and also was not presented with such option. Maybe you mean "administer nodes" permission? In that case it's OK to change the author.
Setting to RTBC.
Comment #21
eafarris commentedIndeed, you are correct. Simply "edit own.." isn't enough.
Comment #22
drumm'Use empty string to denote Anonymous user'
That is programmer language. Something like
t('Leave blank for %anonymous.', array('%anonymous' => theme('placeholder', variable_get('wherever we store the anonymous username', 'Anonymous'))))would be better.Comment #23
Cvbge commentedHere's a patch with suggested help text.
Comment #24
dries commentedIs that how we deal with anonymous users when editing, say, comments? If so, please make sure both have the same help text. If not, we should probably make them behave similar.
Comment #25
dopry commentedIn comments it seems to be done a bit differently... (it uses some form wizardry with variables of different names to skip past the validation process... pretty interesting I'll have to dig deeper into it later.)
Functionally though empty string is set to Anonymous, or whatever is there as long as the username isn't taken....
Comment #26
chx commentedWhile comments work in a whole different way, I vote on this simple approach. In fact, the comment approach would be nice if changed to a silent registration and not this wizardry of this set-that not set... but that's for later.
Comment #27
chx commentedOh and I have not made myself clear: I reviewed this patch both codewise and work-wise.
Comment #28
killes@www.drop.org commentedapplied.
Comment #29
(not verified) commented