Search for REALLY old threads / posts


 
Thread Tools Search this Thread
The Lounge What is on Your Mind? Search for REALLY old threads / posts
# 8  
Old 01-19-2019
Hey Rudi,

If I post the search.php and the HTML template file are you willing to come up with the PHP and HTML code mods to create your "Search By Year" option for this feature request?
# 9  
Old 01-19-2019
I am keen to help / contribute, but am afraid my capabilities are limited. I promise to have a deeper look into the project, but I'll have to start from zero with php, code mods, and HTML.
# 10  
Old 01-19-2019
OK.. "mai pen rai" .... I think this is the basic PHP ....

Code:
<?php
if ($vbulletin->GPC['searchbyyear'] >= 2000 and $vbulletin->GPC['searchbyyear'] <= $date('Y')) {
    $start_year_unixtime = $mktime(0, 0, 0, 1, 1, $vbulletin->GPC['searchbyyear']);
    $end_year_unixtime = $mktime(23, 59, 59, 12, 31, $vbulletin->GPC['searchbyyear']);
    $thread_query_logic[] = "thread.dateline >= " . $start_year_unixtime . " thread.dateline <= " . $end_year_unixtime;
}

I think I just add this logic above ... and set up the HTML and the HTTPD $_POST for this new $vbulletin->GPC['searchbyyear'] var and we are all set.
# 11  
Old 01-19-2019
WAIT!

That will only give threads you started.....

You need all your individual posts, right?

Or do you need all threads you have posted in?
# 12  
Old 01-19-2019
We should go for individual posts, as threads would be accessible from there, wouldn't they? And, the limit to 500 posts should be dropped as there could be more in one year.
# 13  
Old 01-19-2019
Yes... I see that Smilie



Code:
mysql> select count(*) from post where dateline > UNIX_TIMESTAMP(20180101) and dateline < UNIX_TIMESTAMP(20190101) AND username = 'RudiC';
+----------+
| count(*) |
+----------+
|     1841 |
+----------+
1 row in set (0.03 sec)

mysql> select count(*) from post where dateline > UNIX_TIMESTAMP(20170101) and dateline < UNIX_TIMESTAMP(20180101) AND username = 'RudiC';
+----------+
| count(*) |
+----------+
|     1851 |
+----------+
1 row in set (0.03 sec)

mysql> select count(*) from post where dateline > UNIX_TIMESTAMP(20160101) and dateline < UNIX_TIMESTAMP(20170101) AND username = 'RudiC';
+----------+
| count(*) |
+----------+
|     2502 |
+----------+
1 row in set (0.05 sec)

mysql> select count(*) from post where dateline > UNIX_TIMESTAMP(20150101) and dateline < UNIX_TIMESTAMP(20160101) AND username = 'RudiC';
+----------+
| count(*) |
+----------+
|     2638 |
+----------+
1 row in set (0.06 sec)

mysql> select count(*) from post where dateline > UNIX_TIMESTAMP(20140101) and dateline < UNIX_TIMESTAMP(20150101) AND username = 'RudiC';
+----------+
| count(*) |
+----------+
|     1722 |
+----------+
1 row in set (0.08 sec)

mysql> select count(*) from post where dateline > UNIX_TIMESTAMP(20130101) and dateline < UNIX_TIMESTAMP(20140101) AND username = 'RudiC';
+----------+
| count(*) |
+----------+
|     2407 |
+----------+
1 row in set (0.15 sec)


mysql> select count(*) from post where dateline > UNIX_TIMESTAMP(20120101) and dateline < UNIX_TIMESTAMP(20130101) AND username = 'RudiC';
+----------+
| count(*) |
+----------+
|      829 |
+----------+
1 row in set (0.12 sec)

mysql> select count(*) from post where dateline > UNIX_TIMESTAMP(20110101) and dateline < UNIX_TIMESTAMP(20120101) AND username = 'RudiC';
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.14 sec)

# 14  
Old 01-20-2019
Hey Rudi,

Here is the current draft PHP query for this.

Seems to fit the bill what you asked for.

Code:
<?php
if ($vbulletin->GPC['searchbyyear'] >= 2000 and $vbulletin->GPC['searchbyyear'] <= $date('Y')) {
    $max_results = 3000;
    $start_year_unixtime = $mktime(0, 0, 0, 1, 1, $vbulletin->GPC['searchbyyear']);
    $end_year_unixtime = $mktime(23, 59, 59, 12, 31, $vbulletin->GPC['searchbyyear']);
    $nl_query_limit = 'LIMIT ' .   $max_results;
    $thread_query_logic[] = "post.dateline >= " . $start_year_unixtime . " thread.dateline <= " . $end_year_unixtime;
}

This User Gave Thanks to Neo For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

How do i delete threads/posts?

I cannot find the option anywhere when i click on "Edit". (2 Replies)
Discussion started by: johnthebaptist
2 Replies
Login or Register to Ask a Question