vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Unanswered Threads (https://vborg.vbsupport.ru/showthread.php?t=61921)

Reverend 02-25-2004 08:53 PM

Unanswered Threads
 
Looking for a hack that would show "Unanswered Threads" via a link,similar to the Virgin topics "hackette" that was made for vB2x.
I'm currently using a link suggested by KirbyDE
Quote:

/search.php?do=process&replyless=1&replylimit=0
but this still shows some answered threads.

I presume some code needs to be added to search.php or global.php for this to function correctly

Thanks.

Andreas 02-25-2004 09:16 PM

I think the problem is that vB caches search results for up to 1 day.
So if there are answers within this time the threads will be displayed.

One solution to avoid this could be

In search.php FIND
PHP Code:

$url "search.php?$session[sessionurl]searchid=$searchid";
eval(
print_standard_redirect('search')); 

REPLACE that with
PHP Code:

if ($_REQUEST['dontcache'])
  
$url "search.php?$session[sessionurl]searchid=$searchid&dontcache=1";
else
  
$url "search.php?$session[sessionurl]searchid=$searchid";
eval(
print_standard_redirect('search')); 

Still in search.php FIND
PHP Code:

// add to the navbits
 
$navbits[''] = $vbphrase['search_results']; 

ADD above that
PHP Code:

if ($_REQUEST[dontcache])
  
$DB_site->query("DELETE FROM " TABLE_PREFIX "search WHERE searchid='$searchid'"); 

With this modification it should work, just append &dontcache=1 to the link.

Boofo 02-25-2004 09:19 PM

You mean add that to this link at the end?

Quote:

/search.php?do=process&replyless=1&replylimit=0

Andreas 02-25-2004 09:21 PM

Yep.

Boofo 02-25-2004 09:24 PM

Is there a way to get the amount of unanswered threads from this, too?

Reverend 02-25-2004 09:44 PM

Quote:

Originally Posted by KirbyDE
In search.php FIND
PHP Code:

$url "search.php?$session[sessionurl]searchid=$searchid";
eval(
print_standard_redirect('search')); 


There's 3 instances of this on lines 1412 , 2101 , 2232

Andreas 02-25-2004 09:51 PM

Line 1412.

Reverend 02-25-2004 10:12 PM

I can't find this:
Quote:

Originally Posted by KirbyDE
Still in search.php FIND
PHP Code:

// add to the navbits
$navbits .= construct_navbits(array('' => $vbphrase['search_results'])); 


The nearest i found was
Code:

// add to the navbits
 $navbits[''] = $vbphrase['search_results'];

on line 1949

Andreas 02-25-2004 10:17 PM

Hmm ... I wonder why I took code from Beta 7 - lol.
Corrected.

Reverend 02-25-2004 10:44 PM

Strange,its still showing a couple of threads with replies.

Andreas 02-25-2004 10:46 PM

That might happen on the frist call as the cashed search is deleted after displaying the results.

Reverend 02-25-2004 10:59 PM

Nope,after several refreshes,logging out/in and deleting temp internet files it still shows a couple of threads with replies.

Andreas 02-25-2004 11:44 PM

Hmm ...
Does the nocache=1 appear in the URL when the search results are being displayed?

Reverend 02-26-2004 12:09 AM

When the results are displayed the url is forums/search.php?searchid=xxxx

the xxxx is always the same number

Andreas 02-26-2004 12:27 AM

OK, so it still uses the cached results.

Maybe this does work (remove the other mods):

In search.php FIND
PHP Code:

// check our results and decide what to do
switch ($highScore

ABOVE that ADD
PHP Code:

if ($highScore AND $_REQUEST['dontcache']) {
  
$highScore 0;
  
$DB_site->query("DELETE FROM " TABLE_PREFIX "search WHERE searchid=$search[searchid]");



Boofo 02-26-2004 01:07 AM

Will the same line be used for the link then?

EvilLS1 02-26-2004 04:01 AM

Why not show unanswered threads on a forum by forum basis or for specific forums with a link on the index page?

I have it set up like that on my test forum and it seems to work nicely. Comes in handy if you want to quickly see just the unanswered posts from specific forums such as a support or tech forum without having to go to the search page.

To do it, open forumdisplay.php and find:
Code:

$actiontemplates = array(
        'none' => array(
                'FORUMDISPLAY',
                'threadbit',
                'threadbit_deleted',
                'forumdisplay_announcement',
                'forumhome_lastpostby',
                'forumhome_forumbit_level1_post',
                'forumhome_forumbit_level2_post',
                'forumhome_forumbit_level1_nopost',
                'forumhome_forumbit_level2_nopost',
                'forumdisplay_loggedinuser',
                'forumhome_moderator',
                'forumdisplay_moderator',
                'forumdisplay_sortarrow',
                'forumhome_subforumbit_post',
                'forumhome_subforumseparator_post',
                'forumrules'
        )

Replace it with:
Code:

$actiontemplates = array(
        'none' => array(
                'FORUMDISPLAY',
                'threadbit',
                'threadbit_deleted',
                'forumdisplay_announcement',
                'forumhome_lastpostby',
                'forumhome_forumbit_level1_post',
                'forumhome_forumbit_level2_post',
                'forumhome_forumbit_level1_nopost',
                'forumhome_forumbit_level2_nopost',
                'forumdisplay_loggedinuser',
                'forumhome_moderator',
                'forumdisplay_moderator',
                'forumdisplay_sortarrow',
                'forumhome_subforumbit_post',
                'forumhome_subforumseparator_post',
                'forumrules'
        ),
        'getunanswered' => array(
                'FORUMDISPLAY',
                'threadbit',
                'threadbit_deleted',
                'forumdisplay_announcement',
                'forumhome_lastpostby',
                'forumhome_forumbit_level1_post',
                'forumhome_forumbit_level2_post',
                'forumhome_forumbit_level1_nopost',
                'forumhome_forumbit_level2_nopost',
                'forumdisplay_loggedinuser',
                'forumhome_moderator',
                'forumdisplay_moderator',
                'forumdisplay_sortarrow',
                'forumhome_subforumbit_post',
                'forumhome_subforumseparator_post',
                'forumrules'
        )

Find:
Code:

$threadscount = $DB_site->query_first("
Above it add:
Code:

if ($_REQUEST['do'] == 'getunanswered')
{
$condition = "AND replycount=0";
}
else
{
$condition = "";
}

Find:
Code:

                FROM " . TABLE_PREFIX . "thread AS thread
                $deljoin
                WHERE forumid = $foruminfo[forumid]

Replace it with:
Code:

                FROM " . TABLE_PREFIX . "thread AS thread
                $deljoin
                WHERE forumid = $foruminfo[forumid]
                                $condition

Find:
Code:

WHERE thread.threadid IN (0$ids)
Replace it with:
Code:

WHERE thread.threadid IN (0$ids)
$condition

Then just put this somewhere in your forumhome_forumbit_level2_post & forumhome_forumbit_level1_post templates.
Code:

(<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]&do=getunanswered">View Unanswered Threads</a>)

Boofo 02-26-2004 04:57 AM

Quote:

Originally Posted by KirbyDE
OK, so it still uses the cached results.

Maybe this does work (remove the other mods):

In search.php FIND
PHP Code:

// check our results and decide what to do
switch ($highScore

ABOVE that ADD
PHP Code:

if ($highScore AND $_REQUEST['dontcache']) {
$highScore 0;
$DB_site->query("DELETE FROM " TABLE_PREFIX "search WHERE searchid=$search[searchid]");



That works great! Can we do this on a forum by forum basis with a link in each forum just for that forum?

Andreas 02-26-2004 08:14 AM

Yes you can limit that on one (or multiple) forums:

/search.php?do=process&replyless=1&replylimit=0&don tcache=1&forumchoice[]=id

Boofo 02-26-2004 08:19 AM

Like this?

PHP Code:

&forumchoice[1,5,7

or

PHP Code:

 &forumchoice[12

If I put a link in each forum on forumhome, is there a way to pull the ID out automatically of will it do that this way?

Aslo, how can I add this to the search.php so the date and time show up in there too when searching? I have been trying for a couple of hours now to add it there, but to no avail. ;)

Andreas 02-26-2004 08:36 AM

&forumchoice[]=1&forumchoice[]=5&forumchoice[]=7

In the forumhome_forumbit_* and FORUMDISPLAY-Templates you can use $foerumid

Quote:

Aslo, how can I add this to the search.php so the date and time show up in there too when searching? I have been trying for a couple of hours now to add it there, but to no avail. ;)
What do you mean with "so the date and time show up in there too"?

Boofo 02-26-2004 08:45 AM

When you click on View Unanswered threads, the date and time you did for the "Thread Post Time on Forum Display" code you did in the other thread doesn't show up. I thought I would ask about it in here because I don't remember where the other thread is. ;)

Andreas 02-26-2004 09:22 AM

I C.

In search.php FIND
PHP Code:

        // query thread data
        
$dataQuery "
            SELECT 
$previewfield
                thread.threadid, thread.threadid AS postid, thread.title AS threadtitle, thread.iconid AS threadiconid, 

REPLACE that with
PHP Code:

        // query thread data
        
$dataQuery "
            SELECT 
$previewfield
                thread.dateline, thread.threadid, thread.threadid AS postid, thread.title AS threadtitle, thread.iconid AS threadiconid, 

Still in search.php FIND
PHP Code:

eval('$searchbits .= "' fetch_template('threadbit') . '";'); 

ABOVE that ADD
PHP Code:

$thread[created] = vbdate($vboptions['dateformat'], $thread[dateline], 1) . ' ' vbdate($vboptions['timeformat'], $thread[dateline]); 


If you also want to display the thread creation date/time when displaying search results as posts:

In search.php FIND
PHP Code:

         // query post data
        
$dataQuery "
            SELECT post.postid, post.title AS posttitle, post.dateline AS postdateline,
                post.iconid AS posticonid, post.pagetext,
                IF(post.userid = 0, post.username, user.username) AS username,
                thread.threadid, thread.title AS threadtitle, thread.iconid AS threadiconid, thread.replycount, 

REPLACE that with
PHP Code:

         // query post data
        
$dataQuery "
            SELECT post.postid, post.title AS posttitle, post.dateline AS postdateline,
                post.iconid AS posticonid, post.pagetext,
                IF(post.userid = 0, post.username, user.username) AS username,
                thread.dateline AS threaddateline, thread.threadid, thread.title AS threadtitle, thread.iconid AS threadiconid, thread.replycount, 


Still in search.php FIND
PHP Code:

eval('$searchbits .= "' fetch_template('search_results_postbit') . '";'); 

ABOVE that ADD
PHP Code:

$post[threadcreated] = vbdate($vboptions['dateformat'], $post[threaddateline], 1) . ' ' vbdate($vboptions['timeformat'], $post[threaddateline]); 

Add $post[threadcreated] to Template search_results_postbit.

Please note that these modifications will work for all searches, not just for unanswered threads.

PS: Should I release both "thread creation date" mods as hacks? Might be useful for others too ...

Boofo 02-26-2004 09:45 AM

Yes, you should release both of them. Maybe even put them together as one? ;)

And thank you, sir. ;)

Boofo 02-26-2004 09:56 AM

I'm not seeing it show up for the posts. :(

EDIT: Ignore this. I was doing it inside the if condition. I moved it outside that and it works right now for posts. ;) Excellent job, thank you, sir. ;)

Reverend 02-26-2004 06:13 PM

Quote:

Originally Posted by KirbyDE
OK, so it still uses the cached results.

Maybe this does work (remove the other mods):

In search.php FIND
PHP Code:

// check our results and decide what to do
switch ($highScore

ABOVE that ADD
PHP Code:

if ($highScore AND $_REQUEST['dontcache']) {
$highScore 0;
$DB_site->query("DELETE FROM " TABLE_PREFIX "search WHERE searchid=$search[searchid]");



Works perfect. https://vborg.vbsupport.ru/external/2009/06/7.gif

ogden2k 03-02-2004 09:24 PM

Quote:

Originally Posted by Reverend

How many forum choices can I use? Is there a limit on performance?

Andreas 03-02-2004 09:32 PM

Same as for "normal" search.

ogden2k 03-02-2004 09:33 PM

Ok. I have this under Quick Links. When I'm on forum home, I do not see the option under Quick Links, but I do when I'm in a forum...?

This is what I'm using:
Code:

search.php?do=process&replyless=1&replylimit=0&dontcache=1&forumchoice[]=7&forumchoice[]=37&forumchoice[]=10&forumchoice[]=14&forumchoice[]=9&forumchoice[]=38&forumchoice[]=36&forumchoice[]=11&forumchoice[]=8&forumchoice[]=20&forumchoice[]=23


All times are GMT. The time now is 06:51 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01385 seconds
  • Memory Usage 1,864KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (11)bbcode_code_printable
  • (22)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (29)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete