View/search post since x mod

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Anti-Spam Guide
Locked
User avatar
Bard
Registered User
Posts: 449
Joined: Fri Sep 10, 2004 9:49 am
Location: Texas
Contact:

View/search post since x mod

Post by Bard »

There used to be a mod for vers2 that allowed you to view (search) posts within the last x amount of time.
I had mine set to view last week, last 48 hours, last 24 hours.

Is there a mod like this for vers3
A computer once beat me at chess, but it was no match for me at kick boxing.
Old Time Radio Talk | Visit OTR Talk Town
User avatar
Bard
Registered User
Posts: 449
Joined: Fri Sep 10, 2004 9:49 am
Location: Texas
Contact:

Re: View/search post since x mod

Post by Bard »

bump
A computer once beat me at chess, but it was no match for me at kick boxing.
Old Time Radio Talk | Visit OTR Talk Town
User avatar
Bard
Registered User
Posts: 449
Joined: Fri Sep 10, 2004 9:49 am
Location: Texas
Contact:

Re: View/search post since x mod

Post by Bard »

bump
A computer once beat me at chess, but it was no match for me at kick boxing.
Old Time Radio Talk | Visit OTR Talk Town
User avatar
Bard
Registered User
Posts: 449
Joined: Fri Sep 10, 2004 9:49 am
Location: Texas
Contact:

Re: View/search post since x mod

Post by Bard »

Bumpity bump
A computer once beat me at chess, but it was no match for me at kick boxing.
Old Time Radio Talk | Visit OTR Talk Town
User avatar
Bard
Registered User
Posts: 449
Joined: Fri Sep 10, 2004 9:49 am
Location: Texas
Contact:

Re: View/search post since x mod

Post by Bard »

El bumpo grandota
A computer once beat me at chess, but it was no match for me at kick boxing.
Old Time Radio Talk | Visit OTR Talk Town
User avatar
Bard
Registered User
Posts: 449
Joined: Fri Sep 10, 2004 9:49 am
Location: Texas
Contact:

Re: View/search post since x mod

Post by Bard »

la petite bosse
A computer once beat me at chess, but it was no match for me at kick boxing.
Old Time Radio Talk | Visit OTR Talk Town
User avatar
Bard
Registered User
Posts: 449
Joined: Fri Sep 10, 2004 9:49 am
Location: Texas
Contact:

Re: View/search post since x mod

Post by Bard »

Let me simplify this request.

How do I view the posts for the last 24 hours?
A computer once beat me at chess, but it was no match for me at kick boxing.
Old Time Radio Talk | Visit OTR Talk Town
User avatar
Bard
Registered User
Posts: 449
Joined: Fri Sep 10, 2004 9:49 am
Location: Texas
Contact:

Re: View/search post since x mod

Post by Bard »

Urti prego questo che sto cercando la risposta
A computer once beat me at chess, but it was no match for me at kick boxing.
Old Time Radio Talk | Visit OTR Talk Town
User avatar
Bard
Registered User
Posts: 449
Joined: Fri Sep 10, 2004 9:49 am
Location: Texas
Contact:

Re: View/search post since x mod

Post by Bard »

bump
A computer once beat me at chess, but it was no match for me at kick boxing.
Old Time Radio Talk | Visit OTR Talk Town
User avatar
Bard
Registered User
Posts: 449
Joined: Fri Sep 10, 2004 9:49 am
Location: Texas
Contact:

Re: View/search post since x mod

Post by Bard »

Imagine, you stop by and check your posts because you are looking for a particular reply. You leave the site to only realize a little later that while you checked for replys to your post you forgot to check for new messages. So you come back only to find that there have been no new posts over the last three minutes since your last visit. When you really wanted to read the posts since you logged on last night.

Boom...This mod saves the day. You can now read the posts that were made over the last xx amount of time.....
A computer once beat me at chess, but it was no match for me at kick boxing.
Old Time Radio Talk | Visit OTR Talk Town
User avatar
Bard
Registered User
Posts: 449
Joined: Fri Sep 10, 2004 9:49 am
Location: Texas
Contact:

Re: View/search post since x mod

Post by Bard »

Wow, I am the only one in the entire phpbb community that would use this feature! Thats something by itself!
A computer once beat me at chess, but it was no match for me at kick boxing.
Old Time Radio Talk | Visit OTR Talk Town
User avatar
Bard
Registered User
Posts: 449
Joined: Fri Sep 10, 2004 9:49 am
Location: Texas
Contact:

Re: View/search post since x mod

Post by Bard »

ok.....

Is there an easy way to add to search.php the ability to show all posts for the last 24 hours?
A computer once beat me at chess, but it was no match for me at kick boxing.
Old Time Radio Talk | Visit OTR Talk Town
jagjag
Registered User
Posts: 10
Joined: Sun Aug 03, 2008 4:34 am

Re: View/search post since x mod

Post by jagjag »

1. edit search.php and hack the newposts facility

2. find: case 'newposts'

3. below it you'll find 2 SQL statements (one for topics, one for posts)
...
WHERE p.post_time > ' . $user->data['user_lastvisit'] . "
...
WHERE t.topic_last_post_time > ' . $user->data['user_lastvisit'] . '

4. user_lastvisit is the last time you logged in

5. somewhere up above, define a different time point:
$nday=request_var('nday',0);
$since =$nday ? (time() - $nday*86400) : $user_data['user_lastvisit'];

6. and change the 2 statements to use $since
...
WHERE p.post_time > ' . $since . "
...
WHERE t.topic_last_post_time > ' . $since . '

7. your next problem is to fix up the URLS for the pagination links for the paged search results, e.g. [1] [2] [3] ...

8. find this:
$u_search .= ($search_fields != 'all') ? '&sf=' . $search_fields : '';
$u_search .= ($return_chars != 300) ? '&ch=' . $return_chars : '';

and add this after it:
$nday=request_var('nday','');
if($nday) $u_search.='&nday='.$nday;

There may be some other issues (e.g. "topics' vs 'posts'), but that's a starting point.

Try it using search.php?search_id=newposts&nday=5
Locked

Return to “[3.0.x] MOD Requests”