PDA

View Full Version : Sort Thread Hack


Snatch
06-25-2005, 04:22 PM
Hi,

I need this hack in VB3.5 It sorts the Threads to Thread start Date, Last answer date and most answere. But the Coder how has made this hack is not attainable. Can anybode port this gread hack. The Coder "USKA" ist a friend, it no problem if anybody do this.


http://www.vbulletin-germany.com/forum/showthread.php?t=11182



FIRST:

++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +
SQL->"ALTER TABLE `user` ADD `viewmode` SMALLINT DEFAULT '0' NOT NULL ;"
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +

NEXT:

++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +
file FORUMDISPLAY.php
line 522
find:
################################################## ################################################## #
switch ($sortfield)
{
case 'title':
################################################## ################################################## #
before add:
################################################## ################################################## #
// VIEW MODE HAXX BY USKA
$view = $DB_site->query_first("SELECT viewmode FROM user WHERE userid='$bbuserinfo[userid]'");
$viewmode = $view['viewmode'];
if ($viewmode==2) {
$sortby = "replycount";
}
else if ($viewmode==1) {
$sortby = "dateline";
}
else {
$sortby = "lastpost";
}
// ENDE OF VIEW MODE HAXX ...
################################################## ################################################## #
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +

NEXT:

++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +
file FORUMDISPLAY.php
line 540
find:
################################################## ################################################## #
$sqlsortfield = 'lastpost';
$sortfield = 'lastpost';
################################################## ################################################## #
replace:
################################################## ################################################## #
$sqlsortfield = $sortby;
$sortfield = $sortby;
################################################## ################################################## #
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +

NEXT:

++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +
file moderator.php
line 191
find:
################################################## ################################################## #
//setup redirects for other options in moderators cp
################################################## ################################################## #
before add:
################################################## ################################################## #
//################ VIEW MODE HAXX BY USKA ########################
// ANNOTATIONS :
// VIEW MODE 0 == BY LASTPOST
// VIEW MODE 1 == BY THREADSTARTER (HYBRID)
// VIEW MODE 2 == BY NUMBER OF REPLIES
// END OF ANNOTATIONS ...

if ($_POST['do'] == 'starter')
{

$DB_site->query("UPDATE user SET viewmode='1' WHERE userid='$bbuserinfo[userid]'");
$_REQUEST['forceredirect'] = 1;
$url = "forumdisplay.php?$session[sessionurl]f=$forumid";
eval(print_standard_redirect('redirect_viewmode_th readstarter'));
}

if ($_POST['do'] == 'lastpost')
{

$DB_site->query("UPDATE user SET viewmode='0' WHERE userid='$bbuserinfo[userid]'");
$_REQUEST['forceredirect'] = 1;
$url = "forumdisplay.php?$session[sessionurl]f=$forumid";
eval(print_standard_redirect('redirect_viewmode_la stpostby'));
}

if ($_POST['do'] == 'replycount')
{

$DB_site->query("UPDATE user SET viewmode='2' WHERE userid='$bbuserinfo[userid]'");
$_REQUEST['forceredirect'] = 1;
$url = "forumdisplay.php?$session[sessionurl]f=$forumid";
eval(print_standard_redirect('redirect_viewmode_ma xposts'));
}

//################ ENDE ...
################################################## ################################################## #
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +

NEXT:

++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +
ADMINCP -> Styles & Templates -> Style Manager -> Choose your style -> Templates bearbeiten -> DoubleClick Forensansicht Templates -> DOUBLECLICK "FORUMDISPLAY" (<=open)

find:
################################################## ################################################## #
<!-- / controls above thread list -->

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center" style="border-bottom-width:0px">
<tr>
<td class="tcat" width="100%">$vbphrase[threads_in_forum]<span class="normal">: $foruminfo[title]</span></td>
################################################## ################################################## #
after add:
################################################## ################################################## #
<!-- VIEW MODE HAXX BY USKA -->
<td class="vbmenu_control" id="viewmode" nowrap><a href="#goto_viewmode">Sortier Optionen</a><script type="text/javascript"> vbmenu_register("viewmode"); </script></td>
<!-- ENDE VIEW MODE HAXX BY USKA -->

################################################## ################################################## #
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +

NEXT:

++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ +

find:
################################################## ################################################## #
<!-- forum tools menu -->
<div class="vbmenu_popup" id="forumtools_menu" style="display:none">
################################################## ################################################## #
before add:
################################################## ################################################## #
<!-- VIEWMODE ADDITION HAXX BY USKA -->
<div class="vbmenu_popup" id="viewmode_menu" style="display:none">
<form action="moderator.php" method="post" name="threadadminform">
<table cellpadding="4" cellspacing="1" border="0">
<tr>
<td class="thead">Sortiere nach:<a name="goto_viewmode"></a></td>
</tr>
<tr>
<td class="vbmenu_option" title="nohilite">
<div><label for="fa_sta"><input type="radio" name="do" id="fa_sta" value="starter" checked="checked" />Thread start</label></div>
<div><label for="fa_las"><input type="radio" name="do" id="fa_las" value="lastpost" />Letzter Beitrag</label></div>
<div><label for="fa_rep"><input type="radio" name="do" id="fa_rep" value="replycount" />Meisten Antworten</label></div>
</td>
</tr>
<tr>
<td class="vbmenu_option" title="nohilite" align="center">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="f" value="$forumid" />
<input type="submit" class="button" value="$vbphrase[perform_action]" />
</td>
</tr>
</table>
</form>
</div>
<!-- VIEWMODE HAXX ENDE BY USKA -->
################################################## ################################################
Add Phrase viewmode_threadstarter
Themen wurden nach Start-Datum sortiert.

Add Phrase viewmode_lastpostby
Themen wurden nach "neuen Beitr?gen" sortiert.

Add Phrase viewmode_maxposts
Themen wurden nach den meisten Antworten sortiert.

flup
06-25-2005, 04:46 PM
This feature is standard implented with vB3.5.0 if you browse your childforum, you can click on 'reply's' 'rating' etc. and it will be sorted with most reply's or best rating etc.


Good luck :)

Snatch
06-25-2005, 07:21 PM
But i whant to sort about thread start date, so thath the newest Threads alway on top.

GreeTz
Snatch

Gary King
07-22-2005, 05:59 PM
I would like this as well.

Bump!

Freesteyelz
03-16-2006, 09:48 AM
This would be a great mod for forums such as Announcements. If I'm reading this thread correctly, replies to a thread will not bump it to the top in Forum Display and viewable in Forum Home. Only new threads created will be at the top. If this summary is correct, I too would love to have a modification to do it.