CMS MADE SIMPLE FORGE

CGBlog

 

[#10942] Post date older than 10 years ago: can't choose year when editing

avatar
Created By: Paul Baker (paulbaker)
Date Submitted: Fri Mar 18 08:24:28 -0400 2016

Assigned To:
Version: 1.13.3
CMSMS Version: v2.1.2
Severity: Minor
Resolution: None
State: Open
Summary:
Post date older than 10 years ago: can't choose year when editing
Detailed Description:
To recreate:

I used CG_WP2CGBlog module to successfully import blog articles from a Wordpress
site.  Some articles are more than 10 years old. The acticle "post date"
transfers across correctly in the import.  One such article was posted in 2004.

Now try to edit an old blog post (e.g. one posted in 2004). The edit article
page shows the post date year drop down range from 2006-2031 (that is -10 years
from now, + 15 years from now).  It is impossible to select 2004 - the correct
year as stored in the database.  Drop down defaults to first value in list
(2006) and when submitted, the form corrupts the data changing 2004 into 2006. 
This corruption will continue as time goes on because the form drop down only
shows 10 years back.

To correct:

One way of solving this is by changing the default template at
modules/CGBlog/templates/editarticle.tpl and editing this line:

{html_select_date prefix=$postdateprefix time=$postdate start_year="-10"
end_year="+15"}

changing it in to:

{html_select_date prefix=$postdateprefix time=$postdate
start_year="{$postdate|date_format:"%Y" - 10}" end_year="+15"}

so the form shows 10 years back _from the date stored in the database_, what
ever that is.  So even in (say) 30 years time, the edit article form will still
display the correct post date year in the drop down.


History

Comments
avatar
Date: 2016-03-18 08:25
Posted By: Paul Baker (paulbaker)

Discussion at http://forum.cmsmadesimple.org/viewtopic.php?f=7&t=74513
      
Updates

Updated: 2016-03-18 08:25
resolution_id: => 5