Recent Topics

1 Sep 11, 2007 18:37    

First of all: what I've seen of 2.0.0 is very nice and you guys have added some needed features (post per page settable per blog is one of them I was waiting for).

So, I set a blog with 'issue date' sorting ascending (son that older posts come first). The Archive "widget" set in the sidebar continues listing posts in reverse chronological order. I think it should respect the order criteria set for the corresping blog.

Ah, and second thing: Archive plugin doesn't show links in the format specified for the blog, it continues showing with URL parameters: ?p=1&more=1 and so on.

I have for that blog set: Archive Links: Use extra-path; Category links: Use extra-path: category path; Single post links: Use extra-path: post title; Post permalinks: Link to single post

2 Sep 23, 2007 00:52

Yes the archives widget needs some serious rewriting.

3 Sep 23, 2007 21:32

Is there anybody working on this? I might give it a shot, if nobody is working on that, on my absolutely nothing-else-to-do moments.

4 Sep 23, 2007 23:58

Here is a working patch against CVS that solves the post ordering problem in Archives plugin. It should also take into account descending or ascending order for all the other modes (I've only tested with 'postbypost'):

diff -ubrxCVS b2evolution/blogs/plugins/_archives.plugin.php /home/lnieves/liberal/315web/plugins/_archives.plugin.php
--- b2evolution/blogs/plugins/_archives.plugin.php      2007-09-23 23:41:10.000000000 +0200
+++ /home/lnieves/liberal/315web/plugins/_archives.plugin.php   2007-09-23 23:28:20.000000000 +0200
@@ -83,6 +83,7 @@
         *                - 'title' : (Default: T_('Archives'))
         *                - 'mode' : 'monthly'|'daily'|'weekly'|'postbypost' (Default: conf.)
         *                - 'sort_order' : 'date'|'title' (Default: date - used only if the mode is 'postbypost')
+   *                - 'orderdir' : 'DESC'|'ASC' (Default: from Blog settings)
         *                - 'link_type' : 'canonic'|'context' (default: canonic)
         *                - 'context_isolation' : what params need override when changing date/range (Default: 'm,w,p,title,unit,dstart' )
         *                - 'form' : true|false (default: false)
@@ -137,6 +138,13 @@
                elseif(!isset($params['sort_order']) || $params['sort_order'] == '') {
                        $params['sort_order'] = 'date';
                }
+    //Order direction: DESC or ASC. Default comes from the Blog settings:
+    if(!isset($params['orderdir'])) {
+      $params['orderdir'] = $Blog->get_setting('orderdir');
+    }
+    elseif(isset($params['orderdir']) && ($params['orderdir'] != 'DESC' || $params['orderdir'] != 'ASC') ) {
+      $params['oderdir'] = $Blog->get_setting('orderdir');
+    }

                // Link type:
                if(!isset($params['link_type'])) $params['link_type'] = 'canonic';
@@ -167,7 +175,7 @@
                        $params['day_date_format'] = $dateformat;
                }

-               $ArchiveList = & new ArchiveList( $params['mode'], $params['limit'], $params['sort_order'], ($params['link_type'] == 'context'),
+               $ArchiveList = & new ArchiveList( $params['mode'], $params['limit'], $params['sort_order'], $params['orderdir'], ($params['link_type'] == 'context'),
                                                                                                                                                        $this->dbtable, $this->dbprefix, $this->dbIDname );

                echo $params['block_start'];
@@ -331,6 +339,7 @@
                $archive_mode = 'monthly',
                $limit = 100,
                $sort_order = 'date',
+    $orderdir = 'DESC', /* Provide for reverse-date sort of post-by-post archives */
                $preserve_context = false,
                $dbtable = 'T_items__item',
                $dbprefix = 'post_',
@@ -347,6 +356,7 @@
                $this->dbprefix = $dbprefix;
                $this->dbIDname = $dbIDname;
                $this->archive_mode = $archive_mode;
+    $this->orderdir = $orderdir;


                /*
@@ -406,7 +416,7 @@
                                                                                                        .$this->from
                                                                                                        .$this->where.'
                                                                                                        GROUP BY year, month
-                                                                                                       ORDER BY year DESC, month DESC';
+                                                                                                       ORDER BY year '.$this->orderdir.' , month '.$this->orderdir;
                                break;

                        case 'daily':
@@ -417,7 +427,9 @@
                                                                                                        .$this->from
                                                                                                        .$this->where.'
                                                                                                        GROUP BY year, month, day
-                                                                                                       ORDER BY year DESC, month DESC, day DESC';
+                          ORDER BY year '.$this->orderdir.
+                          ' , month '.$this->orderdir.
+                          ' , day '.$this->orderdir;
                                break;

                        case 'weekly':
@@ -428,7 +440,8 @@
                                                                                                        .$this->from
                                                                                                        .$this->where.'
                                                                                                        GROUP BY year, week
-                                                                                                       ORDER BY year DESC, week DESC';
+                          ORDER BY year '.$this->orderdir.
+                          ' , week '.$this->orderdir;
                                break;

                        case 'postbypost':
@@ -440,10 +453,10 @@
                                                                                                        .$this->group_by.'
                                                                                                        ORDER BY ';
                                if($sort_order == 'title'){
-                                       $sql .= $this->dbprefix.'title ASC';
+                                       $sql .= $this->dbprefix.'title '.$this->orderdir;
                                }
                                else if($sort_order == 'date'){
-                                       $sql .= $this->dbprefix.'datestart DESC';
+                                       $sql .= $this->dbprefix.'datestart '.$this->orderdir;
                                }
                }

Additional testing for different archiving modes (I have only tested with postbypost) would be necessary to see if this does what I think it should do.

Have fun!


Form is loading...