Sort by last edited
+2
SarkZKalie
PaltHaltPH
6 posters
Page 1 of 1
Sort by last edited
Technical Details
Forum version : #ModernBBPosition : 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- New Member
- Posts : 1
Reputation : 1
Language : English
Re: Sort by last edited
Well this is close to being impossible, unless you have an external server and a developer with plenty of time on their hands.
Guest- Guest
Re: Sort by last edited
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
then create a new javascript to run on the forum page
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
change index_box template
- Code:
<ul class="linklist">
<!-- BEGIN switch_user_logged_in -->
<li><a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a> • </li>
<li><a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a> • </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> • </li>
<li><a href="{U_TODAY_POSTERS}">{L_TODAY_POSTERS}</a> • </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
Similar topics
» [Solved] Remove "Last Edited by on;Edited 4 times in total" Message for phpBB2 Silver
» How do i get my Forum to look and operate in the following manner (sort of)
» Did you do some sort of update in my forum ?
» Sort Posts in Topics
» Sort Personal Galleries by Date Updated
» How do i get my Forum to look and operate in the following manner (sort of)
» Did you do some sort of update in my forum ?
» Sort Posts in Topics
» Sort Personal Galleries by Date Updated
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum