Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 07-09-2007, 10:11 PM
Silver_2000_)! Silver_2000_)! is offline
 
Join Date: Mar 2002
Location: Texas
Posts: 102
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need query to remove subscriptions

Im hoping someone here can help with a query

I have about 2200 users who were using AOL email addresses and the site owner decided he didnt want to deal with the bounces and issue swith AOL email so he banned AOL email for signups and also removed the AOL addresses from the user profiles - Which causes a diff problem - subscription emails that bounce because they have no send to email address -
So I need to either remove the subscriptions for the offending users or put logic in the email that checks for valid address before it sends

this query will select the 2200 users that have no email address

SELECT *
FROM `user`
WHERE `email` = CONVERT( _utf8 ' '
USING latin1 )
COLLATE latin1_swedish_ci

How do I remove the subscriptions for those users ?

Thanks in advance

Doug
Reply With Quote
  #2  
Old 07-10-2007, 04:47 AM
Farcaster Farcaster is offline
 
Join Date: Dec 2005
Posts: 386
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Given you criteria, you could use this statement to delete the subscriptions for these users for MySQL v4.1+:

[SQL]DELETE sf FROM subscribeforum sf, user u WHERE u.userid = sf.userid AND u.email = CONVERT( _utf8 ' '
USING latin1 ) COLLATE latin1_swedish_ci;

DELETE se FROM subscribeevent se, user u WHERE u.userid = se.userid AND u.email = CONVERT( _utf8 ' '
USING latin1 ) COLLATE latin1_swedish_ci;

DELETE st FROM subscribethread st, user u WHERE u.userid = st.userid AND u.email = CONVERT( _utf8 ' '
USING latin1 ) COLLATE latin1_swedish_ci;[/SQL]
Reply With Quote
  #3  
Old 10-19-2007, 07:10 PM
Silver_2000_)! Silver_2000_)! is offline
 
Join Date: Mar 2002
Location: Texas
Posts: 102
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the help - As a follow up how can I find the users with NO email address and replace the blank email address with their username or better yet set all those users as "Awaiting email confirmation"

Im no sql genuis so any help would be appreciated
Reply With Quote
  #4  
Old 10-19-2007, 08:27 PM
Blaine0002's Avatar
Blaine0002 Blaine0002 is offline
 
Join Date: Jul 2003
Location: Wisconsin.
Posts: 1,350
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Im not sure of some exact code, but you could request the emails from everyone, put them into an array,

explode the array with the @ symbol, then get all that have aol.com and run a delete from user where userid = array userid.
Reply With Quote
  #5  
Old 10-19-2007, 08:36 PM
Silver_2000_)! Silver_2000_)! is offline
 
Join Date: Mar 2002
Location: Texas
Posts: 102
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The issue is that people DONT update their emails - AND we are talking about thousands of accounts - not going to do this manually

previous admins already removed everyones email addresses - now I want to change the primary usergroup for all the folks with NULL-blank email addresses to
"awaiting email confirmation"
Reply With Quote
  #6  
Old 10-19-2007, 10:31 PM
Blaine0002's Avatar
Blaine0002 Blaine0002 is offline
 
Join Date: Jul 2003
Location: Wisconsin.
Posts: 1,350
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

back up your database then
run the query
UPDATE TABLE user set usergroupid = '3' where email = ''
Reply With Quote
  #7  
Old 10-20-2007, 01:01 AM
Silver_2000_)! Silver_2000_)! is offline
 
Join Date: Mar 2002
Location: Texas
Posts: 102
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Blaine0002 View Post
back up your database then
run the query
UPDATE TABLE user set usergroupid = '3' where email = ''
Quote:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TABLE user set usergroupid = '3' where email = ''' at line 1
not sure whats wrong
Reply With Quote
  #8  
Old 10-20-2007, 01:03 AM
Blaine0002's Avatar
Blaine0002 Blaine0002 is offline
 
Join Date: Jul 2003
Location: Wisconsin.
Posts: 1,350
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

doh my bad

UPDATE user set usergroupid = '3' where email = ''
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:33 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.03309 seconds
  • Memory Usage 2,226KB
  • 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
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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
  • 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