The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Sort by last edited

+2
SarkZKalie
PaltHaltPH
6 posters

Go down

In progress Sort by last edited

Post by PaltHaltPH February 27th 2019, 5:15 pm

Technical Details

Forum version : #ModernBB
Position : Founder
Concerned browser(s) : Mozilla Firefox, Google Chrome, Internet Explorer, Opera, Safari, Other
Who the problem concerns : All members
Forum link : http://whitneyai.forumotion.com/

Description of problem

Apologies if this has already been addressed, but I've perused through the FAQ and the search bar and haven't found an answer to my question. Is it possible to sort the topic list by last edited? The current sorting lists use post date, creation date, title, number of views and answers, but not by last edited. And to be more precise, when the original post is edited by the original poster and not when a reply has been made.
PaltHaltPH
PaltHaltPH
New Member

Posts : 1
Reputation : 1
Language : English

Back to top Go down

In progress Re: Sort by last edited

Post by SarkZKalie February 27th 2019, 6:26 pm

As far as I know there is no way to do that


Sort by last edited Sarkzk10
SarkZKalie
SarkZKalie
Support Moderator
Support Moderator

Male Posts : 1446
Reputation : 220
Language : English

https://rotavn.forumotion.com/

Back to top Go down

In progress Re: Sort by last edited

Post by Ape February 27th 2019, 6:39 pm

No sadly there is no setting's in your ACP to do that.


Sort by last edited Left1212Sort by last edited Center11Sort by last edited Right112
Sort by last edited Ape_b110
Sort by last edited Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19450
Reputation : 2011
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

In progress Re: Sort by last edited

Post by Guest February 27th 2019, 8:20 pm

Well this is close to being impossible, unless you have an external server and a developer with plenty of time on their hands.
avatar
Guest
Guest


Back to top Go down

In progress Re: Sort by last edited

Post by _Twisted_Mods_ March 3rd 2019, 4:47 pm

Ok so after a few hours i figured it out .. at least on my forum i have bb3 on my forum but i'm sure someone on here can help if changes are needed but im gonna take a break from it lol

change index_box template
Code:

<ul class="linklist">
   <!-- BEGIN switch_user_logged_in -->
   <li><a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a>&nbsp;•&nbsp;</li>
   <li><a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a>&nbsp;•&nbsp;</li>
   <!-- END switch_user_logged_in -->
   <li><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a></li>
   <!-- BEGIN switch_user_logged_in -->
   <li class="rightside"><a href="{U_MARK_READ}" accesskey="m">{L_MARK_FORUMS_READ}</a></li>
   <!-- END switch_user_logged_in -->
</ul>
      <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
   
          <!-- BEGIN catrow -->
   <!-- BEGIN tablehead -->
      <div class="forabg">
         <div class="inner"><span class="corners-top"><span></span></span>
         <ul class="topiclist">
            <li class="header">
               <dl class="icon">
                  <dd class="dterm"><div class="table-title">{catrow.tablehead.L_FORUM}</div></dd>
               
               </dl>
            </li>
         </ul>
                     <table id="example" class="topiclist table table-bordered" style="width: 100%;">
                                                  <thead style="display:none">
                           <tr>
                           <th><div class="table-title">{catrow.tablehead.L_FORUM}</div></th>
                           <th>{L_TOPICS}</th>
                           <th>{L_POSTS}</th>
                           <th><span>{L_LASTPOST}</span></th>
                           <th>Date</th>
                           </tr>
                        </thead>
   <!-- END tablehead -->

   <!-- BEGIN forumrow -->
            
                        <tbody>
                        <tr>
                           <td class="dterm" style="text-align:left;">
                     <div style="display: block; margin : 0 {catrow.forumrow.INC_LEVEL_RIGHT} 0 {catrow.forumrow.INC_LEVEL_LEFT};">
                        <h{catrow.forumrow.LEVEL} class="hierarchy">
                        <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumtitle">{catrow.forumrow.FORUM_NAME}</a>
                        </h{catrow.forumrow.LEVEL}>
                        <br />
                        {catrow.forumrow.FORUM_DESC}

                        <!-- BEGIN switch_moderators_links -->
                           {catrow.forumrow.switch_moderators_links.L_MODERATOR}{catrow.forumrow.switch_moderators_links.MODERATORS}
                        <!-- END switch_moderators_links -->
                        {catrow.forumrow.L_LINKS}{catrow.forumrow.LINKS}
                        <strong>{forumrow.L_SUBFORUM_STR}</strong> {forumrow.SUBFORUMS}
                     </div>
                  </td>
                  <td class="topics">{catrow.forumrow.TOPICS} <dfn>{L_TOPICS}</dfn></td>
                  <td class="posts">{catrow.forumrow.POSTS} <dfn>{L_POSTS}</dfn></td>
                  <td class="lastpost">
                     <!-- BEGIN ads -->
                     <span class="AD_LastPA">
                                <span class="lastpost-avatar"><img src="{catrow.forumrow.ads.IMG}" alt="{catrow.forumrow.ads.TITLE}" /></span>
                                <span class="AD_LastInfos">
                                    <b><a href="{catrow.forumrow.ads.LINK}">{catrow.forumrow.ads.TITLE}</a></b><br />
                                    {catrow.forumrow.ads.DATE}<br />
                                    {catrow.forumrow.ads.LOCATION}
                                </span>
                     </span>
                            <!-- END ads -->
                     
                            <!-- BEGIN avatar -->
                            <span class="lastpost-avatar">{catrow.forumrow.avatar.LAST_POST_AVATAR}</span>
                            <!-- END avatar -->

                     <span>
                     <!-- BEGIN switch_topic_title -->
                     <a href="{catrow.forumrow.U_LATEST_TOPIC}" title="{catrow.forumrow.LATEST_TOPIC_TITLE}">{catrow.forumrow.LATEST_TOPIC_NAME}</a><br />
                     <!-- END switch_topic_title -->
                     {catrow.forumrow.USER_LAST_POST}
                     </span>
                  </td>
                                                                  <td class="tdate" style="display:none">{catrow.forumrow.USER_LAST_POST}</td>
                  </tr>
                        </tbody>   
                     
   <!-- END forumrow -->

   <!-- BEGIN tablefoot -->
            </table>


         <span class="corners-bottom"><span></span></span></div>
      </div>
   <!-- END tablefoot -->
<!-- END catrow -->

<!-- BEGIN switch_on_index -->
<ul class="linklist">
   <li><a href="{U_TODAY_ACTIVE}">{L_TODAY_ACTIVE}</a>&nbsp;•&nbsp;</li>
   <li><a href="{U_TODAY_POSTERS}">{L_TODAY_POSTERS}</a>&nbsp;•&nbsp;</li>
   <li class="last"><a href="{U_OVERALL_POSTERS}">{L_OVERALL_POSTERS}</a></li>
   <!-- BEGIN switch_delete_cookies -->
   <li class="rightside"><a href="{switch_on_index.switch_delete_cookies.U_DELETE_COOKIES}" rel="nofollow">{switch_on_index.switch_delete_cookies.L_DELETE_COOKIES}</a></li>
   <!-- END switch_delete_cookies -->
</ul>

<!-- END switch_on_index -->


then create a new javascript to run on the forum page
Code:

function comparer(index) {
    return function(a, b) {
        var valA = getCellValue(a, index), valB = getCellValue(b, index);
        return $.isNumeric(valA) && $.isNumeric(valB) ? valA - valB : valA.toString().localeCompare(valB);
    }
}
function getCellValue(row, index){ return $(row).children('td').eq(index).text() }
$(function()
{
$(document).ready(function() {
$('.topiclist').each(function(){
  $(this).find('.lastpost').each(function(){
    var curdate =$(this).nextUntil("br").clone().children().remove().end().text().trim().replace('Guest','');
 
if(curdate.indexOf("Today") >= 0){
var d = new Date();
var today = (d.getMonth()+1) + "/" + d.getDate() + "/" +d.getFullYear();
var datsplit = curdate.split(' ');
curdate = today + ' ' + datsplit[2] + ' ' + datsplit[3];
}
 
if(curdate.indexOf("Yesterday") >= 0){
let now = new Date();
    var defaultDate = now - 1000 * 60 * 60 * 24 * 1;
var d = new Date(defaultDate);
var today = (d.getMonth()+1) + "/" + d.getDate() + "/" +d.getFullYear();
var datsplit = curdate.split(' ');
curdate = today + ' ' + datsplit[2] + ' ' + datsplit[3];
}
 
var ee = new Date(curdate).getTime();
   
  if(isNaN(ee))ee='00000000000';
   
   
    $(this).parent().find('.tdate').text(ee);
  });


    var table = $(this).eq(0);
    var rows = table.find('tr:gt(0)').toArray().sort(comparer(4));
    this.desc = !this.desc;
    if (!this.desc){rows = rows.reverse();}
    for (var i = 0; i < rows.length; i++){table.prepend(rows[i]);}
})
  })
});

then swap your time format to mm/dd/yyyy, time am/pm
it may work with other time formats i didn't test them

what this does is put all the topics in a table so it can be sorted
then it grabs the date from the last topic and converts it to a unix timestamp then places it in a hidden column and sorts the whole table based on that column

if you have issues with stuff displaying weird its probably the bootstrap.min.css in the index_box i put it there to make the table pretty
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

In progress Re: Sort by last edited

Post by skouliki March 19th 2019, 1:34 pm

hello

is this solved?
if yes please mark it as solved

thank you
skouliki
skouliki
Manager
Manager

Female Posts : 15397
Reputation : 1709
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

In progress Re: Sort by last edited

Post by Dice212 March 26th 2019, 8:53 pm

Was this ever solved?
Dice212
Dice212
New Member

Posts : 1
Reputation : 1
Language : English

http://narutor.forumotion.com/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum