Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 General Discussions
  #1  
Old 06-06-2017, 06:09 PM
cmsouth cmsouth is offline
 
Join Date: Apr 2017
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default SQL to Subscribe Users to Channels?

I've searched thru the forum and google, but have not found sql that others have posted to update the channel subscriptions of users - is there a location that others have posted sql they have used?

We have an forum for company only users and want to subscribe them to all channels. I had a developer subscribe everyone to threads, but i've learned that you need to subscribe to channels to get new topics. I can't find any doc on the table structure to do a query by trial/ error, so even that would be helpful. Thx
Reply With Quote
  #2  
Old 07-02-2017, 09:24 AM
delicjous's Avatar
delicjous delicjous is offline
 
Join Date: Nov 2014
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

if you don't discover the answer by yourself I wrote you al little query which selects all users and nodes to insert it into the subsribediscussion.

It is not that easy like it sounds at first, because you have to check some things at first.

At first you have to choose which contenttypes should subscribed by all users.
If you are in phpmyadmin or your sql database you have to check the contenttypeids at the table contenttypes (depends on vB-Version). Then you could compare those ids with your nodes table and change the contenttype (s) at the following query. The publishdate selects the publishdate of all nodes installed by installed of vBulletin.
The publishdate thing only works if you have an clean fresh install which never updated --> because if vBulletn installed a new contenttype or examplenode with an update, it have a higher publishdate
Usually the css examplepage (yourdomain/special/css-examples) have an newer publishdate than the other nodes so I sort that one out by title!
So this is only a short instruction how to do it and you have to change it for your conditions!

If you want to subscribe all user to all channels than you could use the following query:
(try this select at first to see the titles you will subscribe to all users)
Code:
SELECT nodeid, title
from `vB_node` a
    inner join `vB_contenttype` b ON b.`contenttypeid` = a.`contenttypeid`
   where b.`contenttypeid` =23
    and a.title <> 'CSS Examples'
   and a.publishdate > (select publishdate from vB_node where nodeid = 1)
Subscribe ...:
Code:
insert into `vB_subscribediscussion` (userid, discussionid, emailupdate)
select s1.userid, s2.nodeid,1
from 
(select userid from vB_user) as s1
cross join 
(SELECT nodeid 
   from `vB_node` a
    inner join `vB_contenttype` b ON b.`contenttypeid` = a.`contenttypeid`
   where b.`contenttypeid` =23
     and a.title <> 'CSS Examples'
     and a.publishdate > (select publishdate from vB_node where nodeid = 1)) as s2
Hope it helps you to do it by your self!
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 11:18 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.07173 seconds
  • Memory Usage 2,163KB
  • 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
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)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