vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Messages of today, yesterday, the day before (https://vborg.vbsupport.ru/showthread.php?t=24480)

Pyro 08-03-2001 01:11 PM

Ok,

I'm sure I'm blind but didn't fount what I am looking for. I am looking for an simple hack, that produces a combobox with three choices:

messages of today
messages since yesterday
messages of the last three days

You can find a German version of this hack on http://forum.traum-projekt.com (that box with the yellow "go"-button on the top of that page.
The responsible guy there is on vacation so I cannot ask him directly for that hack.

Im sure it's pretty simple - any ideas?
Thanks in advance
Markus

Admin 08-10-2001 02:41 PM

In search.php find
PHP Code:

// ###################### Start posts by user x ####################### 

And above it put
PHP Code:

// ###################### Start get double-daily #######################
if ($action=="getddaily") {
  
// get allowable forums:
  
$forumsql=getallforumsql();

  
// get date:
  
$datesql=" AND thread.lastpost>=".(time()-24*60*60*2);

  
$wheresql="1=1".$forumsql.$datesql;
  
$wheresql.=" AND thread.open<>10";
  if (
$getsearch=$DB_site->query_first("SELECT searchid FROM search WHERE query='".addslashes($wheresql)."'")) {
    
$searchid=$getsearch[searchid];
  } else {
    
// get last search for this user and check floodcheck
    
if ($prevsearch=$DB_site->query_first("SELECT searchid,dateline FROM search WHERE ".iif($bbuserinfo[userid]==0,"ipaddress='$ipaddress'","userid=$bbuserinfo[userid]")." ORDER BY dateline DESC LIMIT 1")) {
      if (
time()-$prevsearch[dateline]<$searchfloodcheck and $searchfloodcheck!=0) { // and !ismoderator()) {
                                
eval("standarderror(\"".gettemplate("error_searchfloodcheck")."\");");
                                exit;
      }
    }
                
// insert query into db
                
$DB_site->query("INSERT INTO search (searchid,query,dateline,querystring,showposts,userid,ipaddress) VALUES (NULL,'".addslashes($wheresql)."',".time().",'".addslashes($query)."',0,$bbuserinfo[userid],'".addslashes($ipaddress)."')");
                
$searchid=$DB_site->insert_id();
  }


  eval(
"standardredirect(\"".gettemplate("redirect_search")."\",\"search.php?s=$session[sessionhash]&action=showresults&getnew=true&searchid=$searchid\");");
}

// ###################### Start get triple-daily #######################
if ($action=="gettdaily") {
  
// get allowable forums:
  
$forumsql=getallforumsql();

  
// get date:
  
$datesql=" AND thread.lastpost>=".(time()-24*60*60*3);

  
$wheresql="1=1".$forumsql.$datesql;
  
$wheresql.=" AND thread.open<>10";
  if (
$getsearch=$DB_site->query_first("SELECT searchid FROM search WHERE query='".addslashes($wheresql)."'")) {
    
$searchid=$getsearch[searchid];
  } else {
    
// get last search for this user and check floodcheck
    
if ($prevsearch=$DB_site->query_first("SELECT searchid,dateline FROM search WHERE ".iif($bbuserinfo[userid]==0,"ipaddress='$ipaddress'","userid=$bbuserinfo[userid]")." ORDER BY dateline DESC LIMIT 1")) {
      if (
time()-$prevsearch[dateline]<$searchfloodcheck and $searchfloodcheck!=0) { // and !ismoderator()) {
                                
eval("standarderror(\"".gettemplate("error_searchfloodcheck")."\");");
                                exit;
      }
    }
                
// insert query into db
                
$DB_site->query("INSERT INTO search (searchid,query,dateline,querystring,showposts,userid,ipaddress) VALUES (NULL,'".addslashes($wheresql)."',".time().",'".addslashes($query)."',0,$bbuserinfo[userid],'".addslashes($ipaddress)."')");
                
$searchid=$DB_site->insert_id();
  }


  eval(
"standardredirect(\"".gettemplate("redirect_search")."\",\"search.php?s=$session[sessionhash]&action=showresults&getnew=true&searchid=$searchid\");");


Now just link to search.php?action=getddaily (note: two d's) for posts from two days ago, and search.php?action=gettdaily (note: two t's) for posts from three days ago. Posts from today are search.php?action=getdaily.
You can make the box itself by yourself. ;)

Hope I helped. :)

Pyro 09-04-2001 02:19 PM

Thanks,

just had the time to check your hack - great! Exactly what I was looking for...

Markus

Meta 12-26-2001 04:46 PM

Yes ... just what i have been looking for.

A few more questions:

1. Is there any possibility to make this more variable? So the user can make a choice as he wants ... last 17 days or last 10 days or something like that. And so we dont have to do for each day one long code ... but only a variable?

2. Is there a possibility to get the results like if i click on "postsonly"? So with the posts and a little preview on it? That i am missing also on the getdaily-function.

3. One problem - or at least for me it seems so - is, if we dont get the posts a "last three days"-function (or a "last ten days"-function even more) isn't such as useful as it could be. E.g the last three days result could be not so differant from the last two day result ... means there are the same threads on the results ... and the user has to find the right posts by himself. He can jump to the beginning ... or jump to the end. But not to the post which has been written three days ago.

I tried a bit playing around which varios ideas on the search.php ... but i didn't find clue. It's not so hard to change the searchresultbit ... but the result isn't that what i wanted. At least until now. Same threats ... no preview ... but i'm a very poor coder also.

So ... nice try ... i had even almost the same idea (i multiplicated the hours ... 48 hrs, 72 hrs and so on) ... but it's not so useful as i would wish ... without the posts.

Any ideas?

(Hm? Yes ... in other words ... what i wish is a real "search by date"-function. Like at least Discus has it.)

Meta 12-26-2001 04:52 PM

(Ooh hell ... i'm a member now. I have to tell all my friends about it.)

Meta 01-04-2002 04:22 PM

Oh ... you can stop searching now. I find my clues for having a "last x days"-view with posts instaed of threads.

If somebody is interested ... i will write them down ... it's mostly three changes in the search.php

Gutspiller 03-23-2003 02:11 AM

What do I need to add so that I can assign which forum IDs it does and doesn't do this from?


All times are GMT. The time now is 03:01 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.04657 seconds
  • Memory Usage 1,769KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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