vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Need query to remove subscriptions (https://vborg.vbsupport.ru/showthread.php?t=151826)

Silver_2000_)! 07-09-2007 10:11 PM

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

Farcaster 07-10-2007 04:47 AM

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]

Silver_2000_)! 10-19-2007 07:10 PM

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

Blaine0002 10-19-2007 08:27 PM

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.

Silver_2000_)! 10-19-2007 08:36 PM

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"

Blaine0002 10-19-2007 10:31 PM

back up your database then
run the query
UPDATE TABLE user set usergroupid = '3' where email = ''

Silver_2000_)! 10-20-2007 01:01 AM

Quote:

Originally Posted by Blaine0002 (Post 1363981)
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

Blaine0002 10-20-2007 01:03 AM

doh my bad

UPDATE user set usergroupid = '3' where email = ''


All times are GMT. The time now is 09:15 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.01098 seconds
  • Memory Usage 1,725KB
  • 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
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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