Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is it possible to block user registration based on the referring URL? I have an open registration WP site (configured so users can post ads and events) and while I typically don't get a lot of spam registrations (there is a reCaptcha involved), I was listed on a site as an example of the capabilities of the theme I'm using, and it generates a lot of "test" type of traffic. I like the traffic, but I don't like people registering just to post false test posts just to see how the site works, so I'd ultimately like to simply block registration from that referring URL. Thanks!

share|improve this question
    
do these spam registrations really have referrer infos? –  onetrickpony Mar 10 '11 at 19:11
    
Yes they do, because technically they're not spam. I am listed on the main developer's site as an "example" on how someone can customize the site (mine is quite customized), so I'm listed on the "Showcase". These people come to my site, and instead of just looking, they feel the need to register and post test ads on the site. I want to disable the registration process for them, but not block them from viewing the site. –  RodeoRamsey Mar 14 '11 at 18:37

2 Answers 2

up vote 0 down vote accepted

You can use "register_post" hook that happens just before the user is saved to the database or you can use "register_form" hook and check the referring URL for a match and die();

share|improve this answer
    
...or hook a function on the wpmu_active_signup filter: if(strpos($_REQUEST['HTTP_REFERER'], 'evil-site.com') !== false) return 'none'; –  onetrickpony Mar 15 '11 at 3:01

Along with what Bainternet said, you could also set a session with that url in it, so if they go to your site and then go to another site/page and come back. You would still have that referring url there to check for.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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