View Full Version : Changing $getnewpost and $getnewthread variable (exclude forums)
Domenico
01-28-2003, 10:52 AM
Hi all,
I want to change the following code in index.php:
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]'");
$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]'");
I want to exclude two forums from these queries, how?
Thank you!
filburt1
01-28-2003, 01:03 PM
Add this to the query:
...AND forumid != forumid1AND forumid != forumid2
Domenico
01-29-2003, 01:36 PM
Originally posted by filburt1
Add this to the query:
...AND forumid != forumid1AND forumid != forumid2
Thanks for answering! :)
Can you please be more specific?
Must I add this to the query:
AND forumid != forumid1 AND forumid != forumid2
Where 1 and 2 must be the forumid's wich are going to be excluded?
Where in the query must I add this?
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]'");
Thank you!
Domenico
02-22-2003, 09:38 AM
Can someone please answer my question since I'm puzzled how to do this. :(
Silenced Soul
02-25-2003, 01:18 AM
Yes, the forumid 1/2 are the forumid's that you don't want to be included, and your queries would look like this:
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit] AND forumid!=forumid1 AND forumid!=forumid2
'");
$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit] AND forumid!=forumid1 AND forumid!=forumid2
'");
Domenico
02-27-2003, 10:07 AM
Originally posted by Silenced Soul
Yes, the forumid 1/2 are the forumid's that you don't want to be included, and your queries would look like this:
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit] AND forumid!=forumid1 AND forumid!=forumid2
'");
$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit] AND forumid!=forumid1 AND forumid!=forumid2
'");
This worked.
Thanks a lot! :)
Too bad none of the other members feeled the need to answer this question. :(
Boofo
02-27-2003, 10:44 AM
I don't find that in the 2.2.9 index.php. Is that an addon?
Domenico
02-27-2003, 02:45 PM
Originally posted by Boofo
I don't find that in the 2.2.9 index.php. Is that an addon?
I still have 2.2.6 and because it has so many hacks I don't upgrade it anymore. My next upgrade will be to 3.x I think.
Anyways, I thought it did work but it stildoes the same as before so this isn't the way to go...
Boofo
02-27-2003, 02:55 PM
I think you want to do it in the search.php, anyway. This is for "Todays Active Threads".
Find:
$wheresql.=" AND thread.open<>10";
and replace it as:
$wheresql.=" AND thread.open<>10 AND thread.forumid!=X";
If you want to do more than one forum, change it to this:
$wheresql.=" AND thread.open<>10 AND thread.forumid!=X AND thread.forumid!=X";
There are 2 instances, one is for members, the other is for guests. If you want to exclude forums for both of them, change both lines.
Domenico
02-28-2003, 06:36 AM
Originally posted by Boofo
I think you want to do it in the search.php, anyway. This is for "Todays Active Threads".
Find:
$wheresql.=" AND thread.open<>10";
and replace it as:
$wheresql.=" AND thread.open<>10 AND thread.forumid!=X";
If you want to do more than one forum, change it to this:
$wheresql.=" AND thread.open<>10 AND thread.forumid!=X AND thread.forumid!=X";
There are 2 instances, one is for members, the other is for guests. If you want to exclude forums for both of them, change both lines.
Hi boofo, thanks for replying! :)
I allready fixed this in search.php where I excluded three forums from the search and that's why I need to remove these three forums also from this query.
When people click on new posts they get less new posts to see because new threads and new posts on index.php still include the three forums excluded from search.php
I hope someone can come up with the solution for this.
feldon23
03-18-2003, 06:57 PM
That's going to get complicated.
Are you trying to make these forums invisible, or only make it possible for users to search for new topics but exclude certain forums?
I could see a cool hack out of this (but the index thing sounds too hard).
-modify search.php to look in a new user profile field "view_new_posts_ignored" and explode(",", $bbuserinfo['view_new_posts_ignored']); or something to get an array of forumids they want ignored.
-modify forumdisplay template to have a "exclude this forum from searches" button. Clicking the button takes you to the user_cp with &ignoreforumid=XX in the URL.
-modify usercp to recognize the ignoreforumid and paste/append it into the "View New Posts Ignored" user profile field.
Is this out of left field?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.