Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sortkey configuration doesn't work; entries are always sorted by creation date #119

Open
wataradio opened this issue May 9, 2023 · 2 comments

Comments

@wataradio
Copy link

sortkey configuration doesn't work; entries are always sorted by creation date.

sortkey available options:

  • creation date
  • modification date
  • page name
  • page ID
  • page tiltle

versions

Blog Plugin 2023-01-12
dokuwiki 2023-04-04 "Jack Jackrum"
PHP 8.1.2-1ubuntu2.11

@wataradio
Copy link
Author

wataradio commented May 9, 2023

I checked blog plugin's helper.php and noticed helper_plugin_blog class's constructor is not called, so $this->sort valiable is empty.

helper.cpp

class helper_plugin_blog extends DokuWiki_Plugin {
    var $sort       = '';      // sort key
    function helper_plugin_blog() {
        // load sort key from settings
        $this->sort = $this->getConf('sortkey');
    }

By chagning the constructor as follows, sort valiable is set and entries are sorted expectedly with sortkey configuration.

class helper_plugin_blog extends DokuWiki_Plugin {
    var $sort       = '';      // sort key
    function __construct() {
        // load sort key from settings
        $this->sort = $this->getConf('sortkey');
    }

@fiwswe
Copy link
Contributor

fiwswe commented May 9, 2023

This is caused by a change in PHP 8.0.0. See: Other incompatible Changes

But to stay backward compatible for users still running PHP <8.0.0 and to avoid code duplication maybe just implement __construct like this:

function __construct() {
        $this->helper_plugin_blog();
    }
    …

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants