01324: PITS puts the wrong Author name in the From field when the Author name changes

Summary: PITS puts the wrong Author name in the From field when the Author name changes
Created: 2013-09-07 15:04
Status: Confirmed, ToDo
Category: Cookbook
From: RandyB
Priority: 1

Description: My posting of this entry illustrates the problem. On the new PITS entry form I replaced the Author that was provided by default (apparently from a cookie). The Author at the bottom of the edit form, above the Save button, correctly shows the new name that I entered, but the From page text variable shows the old name.

This could be a problem when (a) someone is entering a bug report on behalf of someone else, or (b) the first time a user makes a posting (though I haven't tested that), in which case From might be empty.

It's an issue because some users might not notice the wrong name in the From field.

One might argue that it's appropriate to show who actually posted the form, but that would properly be in the Author field not the From field, and it would have to be consistent across postings, and not just when the author changes.

The New issue form only prepares a formatted wiki page with the data the user submitted. When the user saves the page, no changes are made to the posted content. It is possible and desirable for the user to read and edit the page before saving it. It is also possible to edit the page after it has been saved and fix anything wrong, so for me this is not a problem. OTOH if such a need is demonstrated, we can change the label of the first form field from "Author" to "From" - this might be less confusing. --Petko September 07, 2013, at 03:48 PM

Changing the label might reduce the potential confusion a bit, but the real problem is that what the user enters isn't always what will be on the page that is proposed to be saved. Anytime the Author changes, the text the user entered (whether it's labeled Author or From) will seem to the user to have been lost.

Users can correct the error, but it is an error. It seems like the ideal solution (if this is easy to do) is the use the cookie for the default value, as is presently done, but use the value that the user actually entered on the form as the value saved on the page.

As long as the PITS page uses the normal PmWiki editing form and a simple new page template, this is an easy error for the user to spot and fix. But PITS is a wonderful and powerful system that can be adapted for all sorts of things, and so asking the user to spot the problem could be more of an issue in a customized version. RandyB September 07, 2013, at 05:24 PM

Sorry, I couldn't experience the bug at first so I didn't quite understand. Yes, this is a bug and will be fixed ASAP. Thanks for noticing! --Petko September 08, 2013, at 12:30 AM

I have uploaded a new version (might need browser refresh), please test it. I'll try to document the changes later today. --Petko September 08, 2013, at 01:17 AM

Apparently this bug has something to do with the variables_order directive. I, and probably Pm, assumed that in a $_REQUEST variable, $_POST has priority over $_GET which has priority over $_COOKIE. But this can be changed and in some cases the $_COOKIE variable wins. The whole pmwiki core needs to be reviewed for this. UpdateMe --Petko September 08, 2013, at 01:45 AM