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

Reply
 
Thread Tools Display Modes
  #1  
Old 12-10-2014, 01:36 AM
RichieBoy67's Avatar
RichieBoy67 RichieBoy67 is offline
 
Join Date: Apr 2004
Location: CT - Down in a hole..
Posts: 3,057
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default email query

I am able to do a query to delete users with a certain address but what I want to do is just remove the email address so they do not bounce. This is simple but I would like to do a few other things as well to clear out my user email addresses that are not active.

#1 - Remove certain address from users but keep users. For example remove all email addresses that contain .xmail.com

#2 - Take those users with that address and move them to a different usegroup.

I have something like this

PHP Code:
UPDATE
user
SET
usergroupid 
X
WHERE
  email
LIKE 
'%.xmail.com' 
I have not finished though because I need to remove the address as well. Is this right and what do I add for the delete part just to delete the address and not the entire user?

Thanks my Vbulletin family!
Reply With Quote
  #2  
Old 12-10-2014, 02:02 AM
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
Posts: 6,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
UPDATE `userSET `usergroupid`= x WHERE `emailLIKE '%.xmail.com' 
this will change usergroupid to what you set x to
Reply With Quote
  #3  
Old 12-10-2014, 02:07 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just a note to say you should always test queries on a test site first and before doing so on the live site make sure to make a database backup.
Reply With Quote
  #4  
Old 12-10-2014, 04:13 PM
RichieBoy67's Avatar
RichieBoy67 RichieBoy67 is offline
 
Join Date: Apr 2004
Location: CT - Down in a hole..
Posts: 3,057
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ForceHSS View Post
PHP Code:
UPDATE `userSET `usergroupid`= x WHERE `emailLIKE '%.xmail.com' 
this will change usergroupid to what you set x to
Yeah, that is only the first part of the query. Not only do I want to change the usergroup of those with certain email addresses but i want to remove those addresses from the user accounts. This is the part of the query I am having trouble with.

Thanks for the reply my friend!

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

Quote:
Originally Posted by Lynne View Post
Just a note to say you should always test queries on a test site first and before doing so on the live site make sure to make a database backup.
Thanks Lynn, I will make a back up before hand but I am not going to run anything until I am sure it is what I want.
Reply With Quote
  #5  
Old 12-10-2014, 04:25 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You want to remove the address as in setting the email column to an empty value? Or do you want to remove a specific part of the email address?
Reply With Quote
  #6  
Old 12-10-2014, 04:34 PM
RichieBoy67's Avatar
RichieBoy67 RichieBoy67 is offline
 
Join Date: Apr 2004
Location: CT - Down in a hole..
Posts: 3,057
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The entire address. I do not want to lose those members but I do not want those addresses to receive any type of email so I just want to remove the entire address from the user accounts.

Thanks dave
Reply With Quote
  #7  
Old 12-10-2014, 04:43 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's a matter of changing the email column to an empty string:

PHP Code:
UPDATE `userSET `usergroupid`= x, `email` = '' WHERE `emailLIKE '%.xmail.com' 
When you create a new user in the ACP of vBulletin and don't enter an email, vBulletin will do the same and set it to an empty string.
Reply With Quote
Благодарность от:
RichieBoy67
  #8  
Old 12-10-2014, 04:59 PM
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
Posts: 6,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dave View Post
It's a matter of changing the email column to an empty string:

PHP Code:
UPDATE `userSET `usergroupid`= x, `email` = '' WHERE `emailLIKE '%.xmail.com' 
When you create a new user in the ACP of vBulletin and don't enter an email, vBulletin will do the same and set it to an empty string.
tested that myself as I had a feeling it would not work
after you have changed usergroupid try this
UPDATE `user` SET `email`='' WHERE `usergroupid`= x
Reply With Quote
Благодарность от:
RichieBoy67
  #9  
Old 12-10-2014, 05:11 PM
RichieBoy67's Avatar
RichieBoy67 RichieBoy67 is offline
 
Join Date: Apr 2004
Location: CT - Down in a hole..
Posts: 3,057
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dave View Post
It's a matter of changing the email column to an empty string:

PHP Code:
UPDATE `userSET `usergroupid`= x, `email` = '' WHERE `emailLIKE '%.xmail.com' 
When you create a new user in the ACP of vBulletin and don't enter an email, vBulletin will do the same and set it to an empty string.
yeah, I tried this early but it would not work for me though I could have had it wrong. Thanks much

--------------- Added 10 Dec 2014 at 14:12 ---------------

Quote:
Originally Posted by ForceHSS View Post
tested that myself as I had a feeling it would not work
after you have changed usergroupid try this
UPDATE `user` SET `email`='' WHERE `usergroupid`= x
That makes sense to do them separately.

Thanks guys!!
Reply With Quote
  #10  
Old 12-10-2014, 05:18 PM
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
Posts: 6,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Happy to help
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 09:09 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.04483 seconds
  • Memory Usage 2,272KB
  • 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
  • (6)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (2)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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