Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 02-06-2007, 04:36 AM
zylstra zylstra is offline
 
Join Date: Aug 2004
Posts: 144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default MySQL query to show hidden threads in unpostable forums

My situation is described here, http://www.vbulletin.com/forum/showt...18#post1299918. I don't know MySQL. Would someone show me the query to accomplish this?

Thanks.
Reply With Quote
  #2  
Old 02-12-2007, 04:47 PM
zylstra zylstra is offline
 
Join Date: Aug 2004
Posts: 144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, since you guys haven't responded yet I'll rewrite the question here.

We've recently turned some boards into "categories" and put sub forums under them for people to post in. They CANNOT post in the category itself.

We have hundreds of forums. Do you know the SQL query that will show us these posts?
Reply With Quote
  #3  
Old 02-13-2007, 04:59 AM
Analogpoint's Avatar
Analogpoint Analogpoint is offline
 
Join Date: Feb 2007
Posts: 656
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
select * from threads where forumid=XX
XX is the id for the forum that you turned into a category. If you want a fancier SQL statement, such as sorting the threads in a certain order or pulling the threads from more than one forum at a time, let me know.
Reply With Quote
  #4  
Old 02-13-2007, 06:07 AM
zylstra zylstra is offline
 
Join Date: Aug 2004
Posts: 144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for helping. You did not address what I am looking for. Let me try to explain. We changed many forums from letting members post in them to not allowing them to post in them. I do not know the IDs of these forums. I mean I could find all of them, but there are many, and I am looking for only the ones that have posts in them. They are what I am looking for: the numbers (or names) of the forums that contain posts that members cannot post in.
Code:
SELECT forumid FROM forum WHERE threadcount > 0
   AND allowed_to_post = 0
or something like that.
Reply With Quote
  #5  
Old 02-14-2007, 08:09 PM
Analogpoint's Avatar
Analogpoint Analogpoint is offline
 
Join Date: Feb 2007
Posts: 656
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, I understand you now, but I'm not familiar enough with the db schema & bitfield structure to help you. The query would be a join on the forum and forumpermission tables.

Code:
select forum.* from forum, forumpermission where forum.forumid=forumpermission.forumid and forum.threadcound > 0 and forumpermission.forumpermissions=?? order by forum.title
The only thing I'm not sure about is where the ?? are. I believe that field is a bitfield that stores the permissions.
Reply With Quote
  #6  
Old 02-26-2007, 07:42 AM
zylstra zylstra is offline
 
Join Date: Aug 2004
Posts: 144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Analogpoint, we're getting there. I've found the bitfield responsible for the forum options. It does not have to do with permissions. It's all in forum.options:
Code:
<group name="forumoptions">
	<bitfield name="active">1</bitfield>
	<bitfield name="allowposting">2</bitfield>
	<bitfield name="cancontainthreads">4</bitfield>
	<bitfield name="moderatenewpost">8</bitfield>
	<bitfield name="moderatenewthread">16</bitfield>
	<bitfield name="moderateattach">32</bitfield>
	<bitfield name="allowbbcode">64</bitfield>
	<bitfield name="allowimages">128</bitfield>
	<bitfield name="allowhtml">256</bitfield>
	<bitfield name="allowsmilies">512</bitfield>
	<bitfield name="allowicons">1024</bitfield>
	<bitfield name="allowratings">2048</bitfield>
	<bitfield name="countposts">4096</bitfield>
	<bitfield name="canhavepassword">8192</bitfield>
	<bitfield name="indexposts">16384</bitfield>
	<bitfield name="styleoverride">32768</bitfield>
	<bitfield name="showonforumjump">65536</bitfield>
	<bitfield name="warnall">131072</bitfield>
</group>
If I have consolidated my forums so that the only option values that shouldn't contain threads are 85699 and 89795 what should the MySQL code be?

Thanks!

Analogpoint, I figured it out:
Code:
SELECT forum.* FROM forum
WHERE (options = 85699 OR options = 89795)
	AND replycount > 0
ORDER BY title
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:46 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05078 seconds
  • Memory Usage 2,205KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete