Next&Previous page link for group discussion

I think it would be great to add a next/previous page button in group discussion. If one has hundreds of replies from years back for example, the page will be very slow.

Anyone has done it before ?

 

  • You mean pagination? In 1.6.1 it was put in. 

    Go here:

    mod/groups/views/default/forum/viewpost.php

    Find this:

    echo elgg_view('navigation/pagination',array(

         'limit' => 50,

         'offset' => $offset,

         'baseurl' => $baseurl,

         'count' => $count,

         ));

    Change the 'limit' to the number of posts you want to show before pagination kicks in. 

    On a side note, I would like to see pagination on the generic comments as well. Make it even better by having an Ajax loader. Or a rather wacky idea would be to hack the friend-picker code and get the comments placed inside there. Pagination at the top and a really smooth transition to the next set of comments to reduce page scrolling.

  • LOLZ ;-) Yep.. I used to start splitting threads, e.g. Invalid Parameter Exception Part2 , Part3, etc when one Topic Post started becoming too long to scroll and read. TopicPosts --> ViewPosts --> TopicPosts. I believe there **is pagination built into the code, but the threshold is too high and so... l-o-n-g pages ;-)

  • Forgot to mention there might be 2 places in that file you need to edit. I'm currently looking at doing a 'hot topic' check if a topic has over x posts then a 'hot' image appears. There's so much that can be done with the groups discussion they are like a blank canvas just waiting to be drawn on.

  • D if you're there, can you tell me what's wrong with this?

    $hottopic = "<img src="$CONFIG->wwwroot."mod/groups/graphics/forum/hottopic.png">";

    I want to do the following:

    if($forum){

            foreach($forum as $f){

                

                    $count_annotations = $f->countAnnotations("group_topic_post");

                    $hottopic = "<img src="$CONFIG->wwwroot."mod/groups/graphics/forum/hottopic.png">";

     

                     if ($count_annotations > 14){

                echo "<div class=\"forum_latest\">";

                echo "<div class=\"topic_owner_icon\">" . elgg_view('profile/icon',array('entity' => $f->getOwnerEntity(), 'size' => 'tiny', 'override' => true)) . "</div>";

                echo "<div class=\"topic_title\"><p><a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$f->guid}&group_guid={$vars['entity']->guid}\">" . $hottopic . $f->title . "</a></p> <p class=\"topic_replies\"><small>".elgg_echo('groups:posts').": " . $count_annotations . "</small></p></div>";

          }else {

           echo "<div class=\"forum_latest\">";

                echo "<div class=\"topic_owner_icon\">" . elgg_view('profile/icon',array('entity' => $f->getOwnerEntity(), 'size' => 'tiny', 'override' => true)) . "</div>";

                echo "<div class=\"topic_title\"><p><a href=\"{$vars['url']}mod/groups/topicposts.php?topic={$f->guid}&group_guid={$vars['entity']->guid}\">" . $f->title . "</a></p> <p class=\"topic_replies\"><small>".elgg_echo('groups:posts').": " . $count_annotations . "</small></p></div>";

                   }

                echo "</div>";

    But I can't get the code right for the $hottopic image source

  • $hottopic = "<img src='".$CONFIG->wwwroot."mod/groups/graphics/forum/hottopic.png'>";

    ;-)

  • ah ha, good catch cheers. I'll write that down on my list of copy paste code snippets.

     

  • echo elgg_view('navigation/pagination',array(

         'limit' => 50,

         'offset' => $offset,

         'baseurl' => $baseurl,

         'count' => $count,

         ));

     

    Is there a way to make the pagination start from the last posts ?

     

  • You mean when a user opens the discussion they are confronted by the latest post first?

    Should be possible. Check that file again, if you see a "desc" change it to "asc" or vice versa.

  • Great Trajan. I'll look into it. 

    Don't you think its useful to have the latest post first ? :)

  • It can be helpful yes, or what might be better is for the link from forum_latest.php to take you to the latest post but still stay in the original order.

    So if you've got 3 pages (pagination) it'll take you directly to page 3 for latest post, but you can always go back to page 1 and start from the beginning if you like. The reason for this is so as to keep the original post at the top so users know what the starting conversation was all about.