Page 1 of 1

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!

Wordpress Multisite...
Clear all

[Solved] Wordpress Multisite - Flagging a user as spammer, leads to flagging the subsite as spam

1 Posts
1 Users
Famed Member Admin
Joined: 11 years ago
Posts: 2703
Topic starter  

Well this is an odd one ... a bug that has been lingering in Wordpress for over 9 years and it still isn't fixed??
This bug has been reported May 29th 2012, and even logged as such in the WordPress TracTicket (#20774).

So what happens is that when looking at the users of your Wordpress sites, and you mark a user of a sub-site as a spammer, Wordpress suddenly will take down the entire sub-site and mark the entire site as "spam". Yikes!

I do have a temporary fix for this ...
Now keep in mind: this is NOT proper fix for this, rather a temporary bandaid: Create a trigger that prevents a site from being marked as spam.
I mean really, who even uses this? Marking a website as spam?

- when adding this trigger, marking a website as spam will no longer work!
- do this at your own risk, in phpMyAdmin you can drop the trigger if things go sideways

For this we need SQL access to the database of your Wordpress setup, and this needs to a MySQL or MariaDB database (the SQL syntax and/or trigger support may work differently on other database engines). 

Assuming "wp_" is the prefix for your main Wordpress website, and you did find the blogs table (wp_blogs), then add a trigger by executing this SQL statement:

CREATE TRIGGER `prevent_mark_as_spam` BEFORE UPDATE ON `wp_blogs` FOR EACH ROW SET NEW.spam = 0;


What this does: Before a row in the wp_blogs table is being updated (BEFORE UPDATE), the NEW value for the "spam" field will be forced to be 0.
Zero is used to indicate "false", so when the field "spam" = 0 then the site is NOT a spam website.

You can remove the trigger again with:

DROP TRIGGER IF EXISTS `wp_blogs`.prevent_mark_as_spam;