How to preserve comment order in Elgg3x while upgrading from 2x ?

 Elgg 2x enlists comments in chronological order but Elgg 3x makes it reverse, So what is the best and easy way to preserve the comment orders while upgrading from Elgg2x to Elgg3x. I cannot remember any community discussions asking for such a change but still it is there in Elgg 3x rather unexpectedly.

  • You can easily do it by following these steps

    Hope this help.

  • Thanks, I will try to do this. But my basic coding skills (or whatever) are dwindling with age. Please also consider releasing a community plugin, as everyone (or majority) upgrading from 2x to 3x will be needing this, otherwise users of upgraded sites will suddenly find comment orders changed. Many thanks again.

    PS: Yet another sudden unexpected change in 3x: comment box by default is collapsed. Any css trick to keep it opened by default?
    PS2 : You or any plugin dev would like to develop reply to comments, this was present in hype plugins but that is now in dead pool I guess.

  • You or any plugin dev would like to develop reply to comments

    Well, you have to look for some other developer for this. I don't need the old comment system, hence I will not be developing a plugin for this. (PS: I am in favour of the new comment system.)

  • Comment order can be reversed quite easily. There's a plugin hook for that now in Elgg 3. Just create a theme with the following code in start.php:

    <?php
    
    elgg_register_event_handler('init', 'system', 'basic_theme_init');
    
    function basic_theme_init() {
        elgg_register_plugin_hook_handler('config', 'comments_latest_first', 'comments_asc_hook');
    }
    
    function comments_asc_hook(\Elgg\Hook $hook) {
        return false;
    }

    Add a manifest.xml file, e.g.

    <?xml version="1.0" encoding="UTF-8"?>
    <plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
        <name>Basic Theme</name>
        <id>basic_theme</id>
        <author>iionly</author>
        <version>0.1</version>
        <category>enhancement</category>
        <description>Theme customizations.</description>
        <website>https://github.com/iionly</website>
        <copyright>(C) iionly</copyright>
        <license>GNU Public License version 2</license>
        <requires>
            <type>elgg_release</type>
            <version>3.0.0</version>
        </requires>
    </plugin_manifest>

    and the plugin is complete and the comments are again listed the ascending order (oldest first).

    As a sidenote: the number of comments displayed on a page can be configured in a similar manner using the 'config', 'comments_per_page' plugin hook. If the default number of 25 should be changed it's just necessary to register a plugin hook function that returns the desired number of comments to be displayed per page.

  • A whole world of thanks goes to Rohit Gupta and Iionly. Any idea on how to keep the comment box opened by default (as in Elgg 2x) in Elgg 3x.

    @Rohit Gupta, I am also in FULL favour of new comments. What I meant is that: one cannot reply to a reply (comment) in Elgg. This is, however, possible in real world social nets (like facebook) or in all other php social scripts (like Buddypress, Peepso, Easysocial) etc, EXCEPT in Elgg. This type of comments act as a social feature that enhances community participation, imho. Many thanks.