Limit number of blog posts, bookmarks, files, pages on GROUP pages

We are running Elgg  2.3.8, Version - 2016092300 as a "VLE", and make use of Groups (with Group Tools) to support courses.

We would like to limit the number of "activity" items on Group pages. I think the default number set to show is "6" out-of-the-box. I would like to know how to limit this to 3 (or possibly 4, but if I know how, then I can experiment).

I have spent about an hour searching forums, poking code, etc., and I am no further ahead. If someone would kindly explain where/how to make this simple change, I would be most grateful.

(The closest I've got is this sort of thing, but it is too sketchy for me to follow.)

Thanks!

  • Make a copy of this file on your own custom plugin:

    https://github.com/Elgg/Elgg/blob/2.3/mod/groups/views/default/resources/groups/activity.php

    and then add this line on your new copied file around line 44:

    $options["limit"] = 3;

    I have not tested it but I think this should work.

  • Thank you both for your suggestions. Sadly, I have not been successful in implementing either of them. :(

    For Rohit's suggestion: (1) I created a new plugin at `myplug_groups`; (2) created the manifest.xml and start.php files; (3) under the "myplug_groups" dir I built the directory sequence: `/groups/views/default/resources/groups/`; and (4) duplicated that activity.php file with the new line added. But it did not have influence on the output of the "group" page, which continues to list six bookmarks, pages, discussions, etc., rather than three.

    I tried out RvR's trick by including that hook in the start.php file of the plugin, and again no joy. I read the docs on "hooks", and possibly I put that in the wrong place.

    (To be clear: this is intended to limit the summaries of latest bookmarks, files, blogs, pages in the front page of a "group", not to paginate those files, blogs etc. when clicked on to "View all".)

    Perhaps you could check the above and see where I have gone wrong? Or any other ideas?

    Many thanks for your help!

  • Maybe the Widget Manager plugin is of some use for you. Latest version available at https://github.com/ColdTrick/widget_manager/releases and most likely also good to use then the Widget Pack plugin (https://github.com/ColdTrick/widget_pack/releases). Then you can edit the group page widgets in the same way as for example profile page widgets and also change the number of items to show in a widget very easily. The number of items showing up by default won't change (and I think there's no option for this but it would require to modify the code to alter the default number - which would also only affect new widgets/groups added after the change whereas the number for existing widgets is saved in the database).

    If you don't want to use the Widget Manager plugin you would have to override some views of Elgg core as the number of items is hardcoded. For example mod/blog/views/default/blog/group_module.php created the blog widget. Here the line "'limit' => 6," causes 6 items to be displayed. Corresponding views for other widgets exist in other plugins (for other content type) and the groups plugin. You would have to change the limit in each view file (http://learn.elgg.org/en/stable/guides/views.html?highlight=override#overriding-views).