vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Changing $getnewpost and $getnewthread variable (exclude forums) (https://vborg.vbsupport.ru/showthread.php?t=48246)

Domenico 01-28-2003 10:52 AM

Changing $getnewpost and $getnewthread variable (exclude forums)
 
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:
[sql]
...AND forumid != forumid1AND forumid != forumid2
[/sql]

Domenico 01-29-2003 01:36 PM

Quote:

Originally posted by filburt1
Add this to the query:
[sql]
...AND forumid != forumid1AND forumid != forumid2
[/sql]

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

Quote:

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

Quote:

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:

PHP Code:

$wheresql.=" AND thread.open<>10"

and replace it as:

PHP Code:

$wheresql.=" AND thread.open<>10 AND thread.forumid!=X"

If you want to do more than one forum, change it to this:

PHP Code:

$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

Quote:

Originally posted by Boofo
I think you want to do it in the search.php, anyway. This is for "Todays Active Threads".

Find:

PHP Code:

$wheresql.=" AND thread.open<>10"

and replace it as:

PHP Code:

$wheresql.=" AND thread.open<>10 AND thread.forumid!=X"

If you want to do more than one forum, change it to this:

PHP Code:

$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?


All times are GMT. The time now is 05:07 PM.

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.01199 seconds
  • Memory Usage 1,747KB
  • 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
  • (6)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (11)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