My blog is being hammered by sploggers. The good news is that in every case the role displays as "None" in the list of Users. Is there a way to use add_action("user register") in functions.php to prevent these registrations based on the role being empty or None?

While I assume the code would look something like this:

add_action("user register","spike_registrations");

function spike_registrations($user_id){
  //pull out role, evaluate role, if role = "" or None stop registration

What I'm unsure about is the specific code that goes into my function. What is the data set used by the registration process, for example, and how do I pull out the role from that data set? Is there any special way to evaluate the value of role? And what WP function is used to stop the registration process?

Thanks for any ideas how to pull this off. It would save me an hour every few weeks spent going through 20 plus pages worth of bogus registrations.

1 Answer 1


Hmm - if they have no role, it may be that they are coming in through some other way and adding that action will not help.

What plugins do you have active ?

also are you sharing a wp user database with another system?

  • What? I should work? 8-) Plugins: Akismet, Bad Behavior, Register Plus Redux are related to blocking and registration. Not sharing a db with another system (except bbPress). It appears bbPress is the source. But I still want to prevent these registrations from showing up in both WP and bbP. Any idea which functions? Thanks for helping me solve part of the mystery.
    – FredHead
    Oct 16, 2011 at 22:43
  • Hi, I am not expert in bbpress but googling shows others have had this problem with spam users. wordpress.org/support/topic/… Consider moving to new wordpress bbpress plugin wordpress.org/extend/plugins/bbpress that will probably solve a lot of problems. Yes - probably a fair bit of work to 'convert'. I am going to switch, setup is fairly quick and if one does not convert just leaves old forum there, then work not so bad.
    – anmari
    Nov 4, 2011 at 0:16
  • Thanks, Anmari. In theory, I'm off next month and plan to do this upgrade. However, I have had bbPress off the past few weeks and there is no change in the volume of spam. So I'm still looking for a programmatic way to interrupt the registration process and add only registrations where the role is not empty.
    – FredHead
    Nov 4, 2011 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.