When an anonymous user posts a forum topic, the Authored by is not set. Then I, as admin, can't move the topic to other forum because Authored by is required.
I believe this is a node module problem, because forum topics are nodes. I think other node types created by anonymous has the same problem - can't be edited. But I have not checked.

Comments

Steve Dondley’s picture

I traced this problem back to the database. The "name" field for user 0 is blank.

Steve Dondley’s picture

Ignore last post. It's blank for versions 4.6, too.

Steve Dondley’s picture

Status: Active » Needs review
StatusFileSize
new1.21 KB

Here's a patch.

Steve Dondley’s picture

One other thing: the patch at http://drupal.org/node/42955 will need to be applied before testing this.

killes@www.drop.org’s picture

looks good to me.

Cvbge’s picture

I think your solution needs also a updates.inc function to update 4.6 anonymous posts?

chx’s picture

Status: Needs review » Reviewed & tested by the community

No, because in case there is no $node->name , anonymous is filled in. This is elegant and needed.

dries’s picture

Status: Reviewed & tested by the community » Fixed
Cvbge’s picture

Status: Fixed » Active

I'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).

Cvbge’s picture

The 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.

Steve Dondley’s picture

The new bug at http://drupal.org/node/43579 needs to be fixed before this one can be debugged.

Cvbge’s picture

Status: Active » Needs review
StatusFileSize
new930 bytes

The 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.

Steve Dondley’s picture

What's RTBC? Can't even find it on Google.

Cvbge’s picture

patch (Ready To Be Committed) ;)

dries’s picture

If 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?

Cvbge’s picture

If 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.

Cvbge’s picture

StatusFileSize
new1.35 KB

I 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.

eafarris’s picture

Last 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.

Cvbge’s picture

I 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.

Cvbge’s picture

Status: Needs review » Reviewed & tested by the community

I'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.

eafarris’s picture

Indeed, you are correct. Simply "edit own.." isn't enough.

drumm’s picture

Status: Reviewed & tested by the community » Needs work

'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.

Cvbge’s picture

Status: Needs work » Needs review
StatusFileSize
new1.6 KB

Here's a patch with suggested help text.

dries’s picture

Is 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.

dopry’s picture

In 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....

chx’s picture

Status: Needs review » Reviewed & tested by the community

While 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.

chx’s picture

Oh and I have not made myself clear: I reviewed this patch both codewise and work-wise.

killes@www.drop.org’s picture

Status: Reviewed & tested by the community » Fixed

applied.

Anonymous’s picture

Status: Fixed » Closed (fixed)