Closed (fixed)
Project:
Drupal core
Version:
5.x-dev
Component:
node system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Sep 2007 at 20:54 UTC
Updated:
25 May 2008 at 11:31 UTC
Jump to comment: Most recent file
Comments
Comment #1
desbeers commentedThere are currently 3 problems with the 'authority date':
PROBLEMS:
1 - If a use previews a new node and has no 'administer nodes' access; the 'preview date' will be somewhere in 1970. Very ugly.
2 - If a use previews a new node and has no 'administer nodes' access; part of the help-text disappears as mentioned in this issue.
3 - If a user previews a new node and does have 'administer nodes' access and alters the 'authority date field' the proper date is displayed in the preview and the help-text but the form-field will be empty again.
All these problems are only with -new- nodes!
REASON WHY:
1 - $node->date is empty on previewing for people without administer nodes rights.
2 - On first prepare of the node form default values will be filled in; but after preview $node->date will be empty if nothing is filled-in the 'authority-date-field'. The $node->date is used in the help-text.
3 - The form-field will not be filled-in with a default value because there is no $node->nid yet.
SOLUTION:
None yet :-( I managed to solve the problem but it was ugly and maybe unsafe. It seems that the author/date fields are only available for people with'administer nodes' rights and this is checked on several places. In 'node_form' and 'node_submit' for example.
I don't understand why because it looks double for me. If the access in the form is restricted than it should be safe to add missing values. I suppose... $node->name is set anyway (if not anonymous) so why not $node->date or $node->created as well? It gives notices as well when creating a node without admin rights.
I'll make a patch if I have some more knowledge about the safety concerns.
Comment #2
desbeers commentedOeps,
Problem 2 - If a use previews a new node and DOES HAVE 'administer nodes' access; part of the help-text disappears as mentioned in this issue.
Comment #3
JirkaRybka commentedThe most serious problem for me is the 1970's date on non-admin's preview, because it's end-user facing (already reported as bug on my site...). I think it may be solved easily, if I only knew where in code, by simply just using current time in case of empty $node->date, just for the sake of preview-rendering. This would be a tiny 6.x bugfixing patch before we proceed to the rest?
Comment #4
desbeers commentedThe ‘1970’ is the most visible problem, but nr. 2 is worse because the date field it non-functional for creating new nodes. Anyway, attached a patch to fix all 3 problems and some notices.
ALTERED FUNCTIONS:
node_submit():
node_object _prepare():
node_form():
node_preview():
Comment #5
gábor hojtsyThis is indeed a nasty issue and the missing date problem also blocked one patch around that form field description (but I don't remember the issue ID).
Comment #6
moshe weitzman commentedComment #7
JirkaRybka commentedI confirm all the described behaviors (problem 1. even occurs with uid=1 on fresh install).
Tested the patch from #4 on recent 6.x-dev: All mentioned bugs solved, no visible problems for me. I've tested all I can think of (previewing nodes with/-out changing date, removing date from form field, saving nodes straight away with no preview, editing old nodes...), all fine now.
Code reads OK to me, although I'm not much experienced in node module. Deserves RTBC if others agree.
Comment #8
chx commentedWhile this patch works it's a step back. With #access we were able to make the node form consistent. If you are conditionally adding elements then it's inconsistent again :/
Comment #9
desbeers commentedI wasn't sure if the #access in the form was enough (it was already there all the time) and moved the user_access just to be on the safe side (see comment #1).
Now removed the conditional statement and access-rights is still working correct so user_access was unneeded and #access in the form is enough.
Attached a new patch.
Comment #10
chx commentedComment #11
chx commentedSo: I tested the issue and problems are fixed and yes the code is very nice.
Comment #12
gábor hojtsyLooks good to me too. Committed.
Comment #13
hunmonk commentedlooks like this is still a problem in Drupal 5. at the very least, users without 'administer nodes' perms are getting the 1970 date as the created time in their previews.
Comment #14
hunmonk commenteddon't think this is critical as it stands for D5.
Comment #15
ryanj-1 commentedAm I the only one who needs a patch for 5.x? I would make one if I knew how, but my PHP knowledge is very limited. Does anyone have any idea when this is going to be done?
Comment #16
Freso commentedHere's a port of the patch. I haven't tested it though, and there are a few differences between D5's and D6's node.module, so this should be tested properly.
Comment #17
brevity commentedThanks, works fine!
Comment #18
damien tournoud commentedOn code review, the patch looks good (it is very similar to the one from D6). It should indeed work as expected.
Comment #19
sethcohn commentedTested, works to solve the date preview issue(s).
+1
Please add this patch, so it makes it for D5.8, to fix the incorrect previews for those of us who are required to maintain a clean D5 core without non-critical patches.
Comment #20
damien tournoud commentedPatch still applies cleanly.
Comment #21
drummCommitted to 5.x.
Comment #22
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #23
battochir commentedHello Freso,
Thanks for the patch! Very cool of you to make and share it. This date problem was ugly and a nasty pain in the arse. It's been around awhile and I'm surprised that in a supported version of drupal it's not been taken care of in core. Thanks again...you rock,
cheers,
wim