[SOLVED] CGBlog admin section sort by Post Date

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm

[SOLVED] CGBlog admin section sort by Post Date

Post by rotezecke »

my CGBlog articles filter (in backend) does not work as it used to. not sure when this started (definitely more than a year ago). i hoped that someone else would come up with a solution but no-one else seems to have this problem.

when filtering e.g. by "Post Date Ascending" it looks like the script compares the dates as strings. first results:
  • 15 April 2007
  • 15 December 2005
  • 16 July 2006
  • 16 July 2010
  • 20 January 2007
  • ...
if the dates were formated like this yyyy-mm-dd the script would probably work fine, but i don't know where/how to set this for cgblog.

This behaviour carries over to CMSMS 2.0.


----------------------------------------------

Cms Version: 1.12.1

Installed Modules:

CMSMailer: 5.2.2
FileManager: 1.4.5
MenuManager: 1.8.7
News: 2.15.2
CGSmartImage: 1.20.3
Search: 1.7.13
TinyMCE: 2.9.12
CGSimpleSmarty: 1.9.1
CGExtensions: 1.49.7
CGBlog: 1.13.1
CGFeedback: 1.7.2
Captcha: 0.5.2
FormBuilder: 0.8.1.1
JQueryTools: 1.3.7


Config Information:

php_memory_limit:
process_whole_template:
max_upload_size: 10000000
url_rewriting: mod_rewrite
page_extension: .html
query_var: page
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: true


Php Information:

phpversion: 5.4.33
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 0
E_DEPRECATED: 0
memory_limit: 256M
max_execution_time: 30
output_buffering: On
safe_mode: Off (False)
file_uploads: On (True)
post_max_size: 8M
upload_max_filesize: 10M
session_save_path: /tmp (1777)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)


Server Information:

Server Api: cgi-fcgi
Server Db Type: MySQL (mysql)
Server Db Version: 5.5.42
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable
Server Time Diff: No filesystem time difference found


----------------------------------------------
Last edited by rotezecke on Fri Sep 11, 2015 4:40 am, edited 1 time in total.
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm

Re: CGBlog admin section sort by Post Date

Post by rotezecke »

found a way by copying modules/CGBlog/templates/articlelist.tpl to module_custom/CGBlog/templates/articlelist.tpl
and modifying

Code: Select all

{$entry->u_postdate|cms_date_format}
to

Code: Select all

{$entry->u_postdate|cms_date_format:"%Y %m %d"}
one can also change the default setting for cms_date_format in backend but that would have created other problems in my case.
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: [SOLVED] CGBlog admin section sort by Post Date

Post by paulbaker »

That's not really a solution to the problem, more a patch IMHO. Next time you upgrade CGBlog your installation may not work properly because the upgrade may have changed the default articlelist.tpl in such a way that your custom change doesn't work or corrupts something.

The problem is that when you click on "Post Date" column the browser appears to order the column alphabetically in reverse.

This works fine when you have set Date Format String in Global Settings to something like %Y-%m-%d. You then see the articles ordered correctly:
yes.jpg
However if I leave Date Format String blank, I see:
no.jpg
which is incorrect.

As a non-American, I (like most non-Americans) never use any month-first date formats so I prefer Date Format String as %e %B %Y (e.g. 11 January 2015). And again the Post Date ordering does not work properly.

Bottom line is, Post Date ordering only works when Date Format String is one of a few certain values. The ordering should work correctly regardless of this setting. So I'm calling it a bug and I have raised a bug report:
http://dev.cmsmadesimple.org/bug/view/10943
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: [SOLVED] CGBlog admin section sort by Post Date

Post by paulbaker »

The bug report now has a response:
This is because the tablesorter stuff does string sorting, and knows nothing about dates.
I am going to remove the tablesorter stuff in subsequent releases
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
Post Reply

Return to “Modules/Add-Ons”