Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-30-2017, 03:42 PM
kgroneman's Avatar
kgroneman kgroneman is offline
 
Join Date: Aug 2007
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Finding all sticky posts

I've got a lot of forums and a lot of moderators. Sometimes they forget about a sticky post and it gets out of date and needs to be unstuck.

This sql query will show all sticky posts: SELECT * FROM `vb_thread` WHERE sticky = 1

However, it doesn't give me the information in easily readable format I'm looking for. What I want is a query that will show me:
  • The specific forum
  • The title of the sticky post
  • The author of the post
Would someone that knows a lot more about querying be able to help me refine my query to show that information? I would be very appreciative.

Thanks in advance. - Kim
Reply With Quote
  #2  
Old 08-30-2017, 03:50 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Pretty simple to do:

PHP Code:
SELECT forum.titlethread.titlethread.postusername
FROM vb_thread 
AS thread
INNER JOIN vb_forum 
AS forum on thread.forumid forum.forumid
WHERE thread
.sticky 
Reply With Quote
Благодарность от:
Kane@airrifle
  #3  
Old 08-30-2017, 05:18 PM
kgroneman's Avatar
kgroneman kgroneman is offline
 
Join Date: Aug 2007
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Pretty simple to do:
Simple for you anyway. Thanks!

I tried that and it gives me the thread.title and the thread.postusername, but not the forum.title. Can it easily be tweaked a bit to list the forum too?
Reply With Quote
  #4  
Old 08-30-2017, 06:24 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It should already list that, try:

PHP Code:
SELECT forum.title AS forumtitlethread.title AS threadtitlethread.postusername 
FROM vb_thread 
AS thread 
INNER JOIN vb_forum 
AS forum on thread.forumid forum.forumid 
WHERE thread
.sticky 
Reply With Quote
  #5  
Old 08-30-2017, 06:29 PM
kgroneman's Avatar
kgroneman kgroneman is offline
 
Join Date: Aug 2007
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes! Thank you. It works as I had hoped. :up:

--------------- Added [DATE]1504196589[/DATE] at [TIME]1504196589[/TIME] ---------------

One more question if I may. I added the option to sort by date:
PHP Code:
SELECT datelinethread.postusernamethread.title AS threadtitleforum.title AS forumtitleforum.forumid  
FROM vb_thread 
AS thread
INNER JOIN vb_forum 
AS forum on thread.forumid forum.forumid
WHERE thread
.sticky 1
ORDER BY dateline 
Is there a way to have it display a readable date instead of the unix timestamp such as YYYY-MM-DD ?
Reply With Quote
  #6  
Old 08-31-2017, 10:52 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this
Code:
SELECT FROM_UNIXTIME(dateline), thread.postusername, thread.title AS threadtitle, forum.title AS forumtitle, forum.forumid 
FROM vb_thread AS thread 
INNER JOIN vb_forum AS forum on thread.forumid = forum.forumid 
WHERE thread.sticky = 1 
ORDER BY FROM_UNIXTIME(dateline)
Reply With Quote
Благодарность от:
kgroneman
  #7  
Old 09-01-2017, 02:14 PM
kgroneman's Avatar
kgroneman kgroneman is offline
 
Join Date: Aug 2007
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Simon and Dave. You've just made managing sticky posts across a lot of forums a lot easier. I sincerely appreciate the time you've taken to assist me. :up: :up: :up:
Reply With Quote
Reply


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 06:52 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.11120 seconds
  • Memory Usage 2,234KB
  • Queries Executed 13 (?)
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
  • (1)bbcode_code
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (2)post_thanks_box_bit
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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_postinfo_query
  • fetch_postinfo
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete