• Services
    • Website Design & Development
    • E-Commerce Shopping Cart Development
    • Website Management
    • Web app & website integration
    • School Website Design
    • Competition Website Design
  • Portfolio
  • Testimonials
  • Contact
  • Blog
  • 01298 816080
  • Menu Menu
You are here: Home1 / Code Snippets2 / MySql3 / WordPress Spam BuddyPress Easy MySQL Spam Filter Query

WordPress Spam BuddyPress Easy MySQL Spam Filter Query

Code Snippets, MySql

WordPress spam sign ups are a real pain. If you need to do some work on the database to do a mass clean-up of spam users. I created this little MySql query which basically counts the number of full-stops or dots in an email address. Having recently done this for a client, I noticed a pattern especially in @gmail accounts where the same word is used as an email address but has full stops positioned in different places in the email address. To the human eye this sticks out like a sore thumb. So in order to check via a query I created this query.

Its looking for the first part of email addresses up to the ‘@’ symbol, with more than 3 dots in it. Now most humans would have 3 maximum thats the way we do things. But you could change to 4 to be ultra sure. I think that anything above 6 is a definite spam bot. But proceed with caution and goes without saying backup your database.


SELECT wp_users.ID,
wp_users.user_login,
wp_users.user_nicename,
wp_users.user_email,
(SELECT SUBSTRING_INDEX(wp_users.user_email,'@',1)) as 'email_part_1',
ROUND (
(
LENGTH((SELECT SUBSTRING_INDEX(wp_users.user_email,'@',1)))
- LENGTH( REPLACE ( (SELECT SUBSTRING_INDEX(wp_users.user_email,'@',1)), ".", "") )
) / LENGTH(".")
) AS 'counter',
wp_users.display_name
FROM wp_users
WHERE
ROUND (
(
LENGTH((SELECT SUBSTRING_INDEX(wp_users.user_email,'@',1)))
- LENGTH( REPLACE ( (SELECT SUBSTRING_INDEX(wp_users.user_email,'@',1)), ".", "") )
) / LENGTH(".")
) > 3
order by ROUND (
(
LENGTH((SELECT SUBSTRING_INDEX(wp_users.user_email,'@',1)))
- LENGTH( REPLACE ( (SELECT SUBSTRING_INDEX(wp_users.user_email,'@',1)), ".", "") )
) / LENGTH(".")
) DESC

  • Share:
  • Facebook
  • Twitter
  • Pinterest
  • Linkedin
  • Google+
September 8, 2013/by Martin Toner Web Designer Developer
Share this entry
  • Share on Facebook
  • Share on Twitter
  • Share on WhatsApp
  • Share on Pinterest
  • Share on LinkedIn
  • Share on Tumblr
  • Share on Vk
  • Share on Reddit
  • Share by Mail
https://sk23.co.uk/wp-content/uploads/2019/09/sk23logo.svg 0 0 Martin Toner Web Designer Developer https://sk23.co.uk/wp-content/uploads/2019/09/sk23logo.svg Martin Toner Web Designer Developer2013-09-08 10:58:502013-09-17 08:42:23WordPress Spam BuddyPress Easy MySQL Spam Filter Query

Pages

  • About
  • Blog
  • Competition Website Design
  • Contact
  • E-Commerce Shopping Cart Development
  • Home
  • Magento CE E-Commerce Shopping Cart Web Development
  • Payment Confirmation
  • Payment Failed
  • School Website Design
  • Serious Coding
  • Simple Unlimited Page Website
  • Testimonials
  • Thanks
  • Web app & website integration
  • Website Management
  • Website Design & Development
  • Buxton Web Designer + Developer
  • High Peak Web Designer
  • Recent Web Design Projects Portfolio

Categories

  • Code Snippets
  • Design
  • Fun Stuff
  • Latest Work
  • Magento
  • Magento Guides
  • Magento Modules
  • MySql
  • Our Work
  • PHP
  • PHP Development Work
  • Website work.
  • Wordpress

Archive

  • February 2024
  • February 2023
  • October 2022
  • June 2022
  • August 2019
  • December 2016
  • July 2014
  • April 2014
  • September 2013
  • June 2013
  • March 2013
  • February 2013
  • October 2012
  • May 2012
  • February 2012
  • January 2012
  • October 2011
  • September 2011
  • February 2011
  • January 2011
  • October 2010

Contact Us

If you are looking for a new website , e-commerce store, web application or just some advice please get in touch.

info@sk23.co.uk 01298 816080

Address

SK23Design
Suite 1,
4 Market St,
Chapel-en-le-Frith,
High Peak SK23 0HH

Partners

Recent

  • Magento 2.4 – Why Your Custom Theme’s Css Is Not Being Compiled
  • Magento 2.4 – Change Product Details From Tabs to Accordion On Desktop
  • Magento 2.4 Bulk Updates Not Working Or Appearing In The Action Log
  • Magento 2.4 Disable Page Builder For Category Description
  • Magento 2 UK Shipping

Categories

  • Code Snippets
  • Design
  • Fun Stuff
  • Latest Work
  • Magento
  • Magento Guides
  • Magento Modules
  • MySql
  • Our Work
  • PHP
  • PHP Development Work
  • Website work.
  • Wordpress
  • Web Design High Peak
  • Web Design Buxton
  • Web Designer Chapel-en-le-Frith
  • Loqate
2026 © Copyright - SK23 Design IT - Websites and Web Development Services | Website by SK23Design
Mr Men Funmr websiteHighlight Current Post Category In WordPress Categories Widget Using jQuery... Scroll to top