How can i change the feed sort order?

I try to reorder my feeds. In preferences → feeds i can change this but after click on “Exit preferences” i see the old order only. I checked the order in preferences again and there is only the old sort order. My changes are lost. I tried to reset the sorting order in preferences but this did not help too. Now are all my feeds sorted from A to Z and not only the 5 feeds i had selected before.

From Git repository browser
e038374…2c51fac master → origin/master
Updating e038374…2c51fac

Lubuntu16.04LTS, PHP 7.0.22-0ubuntu0.16.04.1, mysql Ver 14.14 Distrib 5.7.21

this has been reported before (search for it) but so far i haven’t been able to replicate any problems with drag and drop reordering, it just works for me. it could be something related to your local configuration.

as a worst case scenario workaround you can adjust the order through a database editor like phppgadmin/phpmyadmin.

I made the next mistake and clicked on “Reset Category Sort Order”. Now all categories are sorted too from A to Z and i cannot change it back.
Another point to adress is the following. After changing the sort order, all categories are expanded and i have 153 feeds in 20 categories.

Here the error log i get displayed after trying to sort my categories:

Error	Filename	Message	User	Date
E_WARNING (2)	classes/pref/filters.php:35	Invalid argument supplied for foreach()
1. classes/pref/filters.php(35): ttrss_error_handler(2, Invalid argument supplied for foreach(), classes/pref/filters.php, 35, Array)
2. backend.php(123): savefilterorder()
admin	18:13
E_WARNING (2)	classes/pref/filters.php:35	Invalid argument supplied for foreach()
1. classes/pref/filters.php(35): ttrss_error_handler(2, Invalid argument supplied for foreach(), classes/pref/filters.php, 35, Array)
2. backend.php(123): savefilterorder()
admin	18:13
E_WARNING (2)	classes/pref/filters.php:35	Invalid argument supplied for foreach()
1. classes/pref/filters.php(35): ttrss_error_handler(2, Invalid argument supplied for foreach(), classes/pref/filters.php, 35, Array)
2. backend.php(123): savefilterorder()
admin	18:12
E_WARNING (2)	classes/pref/filters.php:35	Invalid argument supplied for foreach()
1. classes/pref/filters.php(35): ttrss_error_handler(2, Invalid argument supplied for foreach(), classes/pref/filters.php, 35, Array)
2. backend.php(123): savefilterorder()
admin	18:11
E_WARNING (2)	classes/pref/filters.php:35	Invalid argument supplied for foreach()
1. classes/pref/filters.php(35): ttrss_error_handler(2, Invalid argument supplied for foreach(), classes/pref/filters.php, 35, Array)
2. backend.php(123): savefilterorder()
admin	18:11
E_WARNING (2)	classes/pref/filters.php:35	Invalid argument supplied for foreach()
1. classes/pref/filters.php(35): ttrss_error_handler(2, Invalid argument supplied for foreach(), classes/pref/filters.php, 35, Array)
2. backend.php(123): savefilterorder()
admin	18:10
E_WARNING (2)	classes/pref/filters.php:35	Invalid argument supplied for foreach()
1. classes/pref/filters.php(35): ttrss_error_handler(2, Invalid argument supplied for foreach(), classes/pref/filters.php, 35, Array)
2. backend.php(123): savefilterorder()
admin	18:09
E_WARNING (2)	classes/pref/filters.php:35	Invalid argument supplied for foreach()
1. classes/pref/filters.php(35): ttrss_error_handler(2, Invalid argument supplied for foreach(), classes/pref/filters.php, 35, Array)
2. backend.php(123): savefilterorder()
admin	18:08
E_WARNING (2)	classes/pref/filters.php:35	Invalid argument supplied for foreach()
1. classes/pref/filters.php(35): ttrss_error_handler(2, Invalid argument supplied for foreach(), classes/pref/filters.php, 35, Array)
2. backend.php(123): savefilterorder()
admin	18:08
E_WARNING (2)	classes/pref/filters.php:35	Invalid argument supplied for foreach()
1. classes/pref/filters.php(35): ttrss_error_handler(2, Invalid argument supplied for foreach(), classes/pref/filters.php, 35, Array)
2. backend.php(123): savefilterorder()
admin	18:08
E_WARNING (2)	classes/pref/filters.php:35	Invalid argument supplied for foreach()
1. classes/pref/filters.php(35): ttrss_error_handler(2, Invalid argument supplied for foreach(), classes/pref/filters.php, 35, Array)
2. backend.php(123): savefilterorder()
admin	18:03

this is filters though, i’m not sure what you’re having troubles with. filters or feeds? or both?

Filters are complete empty. I do not know why there are any logging from filters. There should be only some entries from sorting and nothing more.

Interessing is that the order_id is zero for ttrss_feed_categories and ttrss_feed. If i change the order for category or feed then there should be a change viewable but nothing. The order_id sits on zero.

I thought that resetting feed/category order would set this to zero and after reload all feeds and categories are logical renumbered. No, no change and the order_id is zero.

order_id only overrides natural sorting if it is non-zero. this column should be set when you order things manually.

you can try saving and investigating the JSON object that is send to backend on drag finished (classes/pref_feeds.php method savefeedorder), maybe it is corrupted somehow or blank.

it’s also possible that clean() doesn’t like the object thus breaking it, you can try removing the call and checking if it helps at pref/feeds.php line 392. i.e.

@@ -389,7 +389,7 @@ class Pref_Feeds extends Handler_Protected {
        }

        function savefeedorder() {
-               $data = json_decode(clean($_POST['payload']), true);
+               $data = json_decode($_POST['payload'], true);

I can not find “classes/pref_feeds.php”. I have only /var/www/tt-rss/classes/pref/feeds.php.
In function savefeedorder commented out the first line and added your second line without “clean”.

With your line it works as expected. Changes of the feed or category order are now viewable. I will try a second browser to be sure.
Tried a second browser and it worked there too. My problem is solved.

Please can you turn off the autoexpanding all feed in the preferences or make it at least configurable?

the above should be fixed in trunk now

there was supposed to be a threshold for this based on amount of feeds but for some reason i never end up adding it, i’ll disable autoexpand for the time being.

I guess I’m a bit late, but regarding the autoexpand: Could the feed tree be expanded when there is a nonempty search term, something like
$expandTree = $feed_search ? "autoExpand='true'": ''
and then use $expandTree in the html?

not a bad idea, i’ll take a look at this

e: done