vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   SQL Query to get User's Subscribed Threads with New Posts (https://vborg.vbsupport.ru/showthread.php?t=318052)

induslady 03-31-2015 05:36 AM

SQL Query to get User's Subscribed Threads with New Posts
 
Hello,

Am looking for SQL Query that gives a User's subscribed threads that has New Posts.

Say the below query :
Code:

SELECT * FROM `vb3_subscribethread` WHERE userid=<userid>
gives the list of threads subscribed by a user. Of these, which are the threads that has new posts and what would be the query for the same.

Appreciate an earliest response.
Thanks.

kh99 03-31-2015 10:15 AM

I don't know if it can be done in one query, but if you look at subscription.php, the section where $_REQUEST['do'] == 'viewsubscription', it does it there. It looks like for each thread it gets the lastread time for the forum that contains the thread, then (in process_thread_array() which is in ncludes/functions_forumdisplay.php) if the thread lastpost time is greater than the forum last read time, it checks either $thread['threadread'] or the cookie value, depending on how thead views are being recorded.


All times are GMT. The time now is 07:05 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.01016 seconds
  • Memory Usage 1,707KB
  • 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
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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