Sort Order Toggle

License Latest Stable Version Total Downloads

A Flarum extension.

Usage

Add a button next to Flarum's sort dropdown for you to toggle between ascending and descending. There are no settings, just enable and use.

Installation

Install with composer:

composer require blomstra/sort-order-toggle:"*"

Updating

composer update blomstra/sort-order-toggle
php flarum cache:clear

Sponsored

The initial implementation of this extension was sponsored by Kagi Search and is released as open source for the wider Flarum community to benefit.

Blomstra offers highly available managed Flarum hosting and custom extension development. Contact our helpdesk for further information

    There is no need to add it into the core. Flarum core should be fast and simple with a easy way for extending .) Why dont you like extensions?

      Eldenroot I don't want to use too many extensions to get a nice look. There are almost 70-80 extensions.

        IanM these new features are mind-blowing. Thanks bro 👍

        Edit:
        Umutcan I wish to visit your site

          Umutcan a "nice look" is very opinionated. Not everyone is aiming for the look that you need. This level of opinionatedness does not belong in the software Flarum aims to be.

          Braden glad you like 'em!

            5 days later

            Composer tells me I can’t install this because the extension isn’t compatible with my PHP version. I’m using PHP 8.0.16.

              010101 your command line PHP version might be different than the web version.

              I see on Packagist this extension requires PHP ^8.0 so that version should work.

              If the Composer output doesn't show your version you can check with php -v . If it's the wrong version you could either switch the default version (method depends on the hosting) or call Composer with a specific version, like php8.0 composer [...] (executable name might depend on the hosting).

                clarkwinkelmann Thank you! Now I remember someone else asking this in another thread. This was the problem. 🙏

                I was able to install this by forcing php80 to be used when running the composer command.

                6 months later

                Version 0.2.0

                This release doesn't bring any visual change to the UI, but it contains important changes that greatly improve the compatibility with other extensions and allow easier re-use of the component on custom pages.

                • Switching to opposite sorting now updates the URL with the new sort for perma-linking
                • If the sort option has no native opposite, a URL query string is automatically created for it by prepending - in front of the original query string
                • Opposite sorting can now be pre-loaded at page load through perma-links
                • The active state on the toggle button now indicates an auto-generated opposite sort is in use. When switching between 2 native sort options, the label will change and the icon will switch direction
                • Toggle button now disabled in search results, because it was never possible to sort results by least relevant (Flarum doesn't support it)

                Developers: the hidden app.__sortDirection attribute is no longer used. app.discussions.extendedSortMap() was added which works just like app.discussions.sortMap() but also returns all auto-generated opposite sorts that might be used.

                2 months later

                Thanks for developing this extension. When I tried to installed it, it says:

                Problem 1
                - blomstra/sort-order-toggle[0.1.0, ..., 0.2.0] require php 8.0 -> your php version (7.4.32) does not satisfy that requirement.
                - Root composer.json requires blomstra/sort-order-toggle * -> satisfiable by blomstra/sort-order-toggle[0.1.0, 0.1.1, 0.2.0].

                Please help me with this. Thanks.

                By the way, it is the same when I tried to install "Conversations by Email" by blomstra. May I also mention this issue in this post?

                • IanM replied to this.

                  ash3T require php 8.0 -> your php version (7.4.32

                  Most (if not all) Blomstra extensions require PHP 8.0 or later. It looks like you are using 7.4.32, therefore composer cannot install the packages for you.

                  To resolve this, you'll need to upgrade your PHP version

                    IanM Sorry, I forgot to mention I used Cpanel, and I changed the php to 8.0. But it still returns with the same message.

                      ash3T you also need to make sure you command line pho version is minimum 8. You can check with php -v to see you command like version.

                      10 months later

                      IanM Can we have this on user profile please? I guess it will be very useful to sort user's posts and discussions

                      a year later

                      hey buddy, I install this extension, but it seems there is no any changes in the forum.
                      where can I see the function in the front of the site