Razasharp
04-08-2006, 12:23 AM
Would appreciate some help with this plug-in please :)
I am trying to add something to the hook:
($hook = vBulletinHook::fetch_hook('forumdisplay_sort')) ? eval($hook) : false;
in forumdisplay.php
I simply want to add:
case 'dateline':
so that I can sort threads in a particular forum in the order they were created (rather than by last-post).
I found this thread which outlines how to do it by hacking files - but I'd rather it be a plug-in if possible: https://vborg.vbsupport.ru/showthread.php?t=75242&highlight=date+posted+forumdisplay
Here is a snippet of the forum display code so you don't have to hunt it out :)
// look at sorting options:
if ($vbulletin->GPC['sortorder'] != 'asc')
{
$sqlsortorder = 'DESC';
$order = array('desc' => 'selected="selected"');
$vbulletin->GPC['sortorder'] = 'desc';
}
else
{
$sqlsortorder = '';
$order = array('asc' => 'selected="selected"');
}
switch ($sortfield)
{
case 'title':
$sqlsortfield = 'thread.title';
break;
case 'lastpost':
$sqlsortfield = 'thread.lastpost';
break;
case 'replycount':
case 'views':
case 'postusername':
$sqlsortfield = $vbulletin->GPC['sortfield'];
break;
case 'voteavg':
if ($foruminfo['allowratings'])
{
$sqlsortfield = 'voteavg';
break;
} // else, use last post
default:
$handled = false;
($hook = vBulletinHook::fetch_hook('forumdisplay_sort')) ? eval($hook) : false;
if (!$handled)
{
$sqlsortfield = 'thread.lastpost';
$sortfield = 'lastpost';
}
}
$sort = array($sortfield => 'selected="selected"');
if (!can_moderate($forumid, 'canmoderateposts'))
{
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canseedelnotice']))
{
$visiblethreads = " AND visible = 1 ";
}
else
{
$visiblethreads = " AND visible IN (1,2)";
}
}
else
{
$visiblethreads = " AND visible IN (0,1,2)";
}
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('forumdisplay_query_thre adscount')) ? eval($hook) : false;
Thanks in advance!
I am trying to add something to the hook:
($hook = vBulletinHook::fetch_hook('forumdisplay_sort')) ? eval($hook) : false;
in forumdisplay.php
I simply want to add:
case 'dateline':
so that I can sort threads in a particular forum in the order they were created (rather than by last-post).
I found this thread which outlines how to do it by hacking files - but I'd rather it be a plug-in if possible: https://vborg.vbsupport.ru/showthread.php?t=75242&highlight=date+posted+forumdisplay
Here is a snippet of the forum display code so you don't have to hunt it out :)
// look at sorting options:
if ($vbulletin->GPC['sortorder'] != 'asc')
{
$sqlsortorder = 'DESC';
$order = array('desc' => 'selected="selected"');
$vbulletin->GPC['sortorder'] = 'desc';
}
else
{
$sqlsortorder = '';
$order = array('asc' => 'selected="selected"');
}
switch ($sortfield)
{
case 'title':
$sqlsortfield = 'thread.title';
break;
case 'lastpost':
$sqlsortfield = 'thread.lastpost';
break;
case 'replycount':
case 'views':
case 'postusername':
$sqlsortfield = $vbulletin->GPC['sortfield'];
break;
case 'voteavg':
if ($foruminfo['allowratings'])
{
$sqlsortfield = 'voteavg';
break;
} // else, use last post
default:
$handled = false;
($hook = vBulletinHook::fetch_hook('forumdisplay_sort')) ? eval($hook) : false;
if (!$handled)
{
$sqlsortfield = 'thread.lastpost';
$sortfield = 'lastpost';
}
}
$sort = array($sortfield => 'selected="selected"');
if (!can_moderate($forumid, 'canmoderateposts'))
{
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canseedelnotice']))
{
$visiblethreads = " AND visible = 1 ";
}
else
{
$visiblethreads = " AND visible IN (1,2)";
}
}
else
{
$visiblethreads = " AND visible IN (0,1,2)";
}
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('forumdisplay_query_thre adscount')) ? eval($hook) : false;
Thanks in advance!