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.

Hi to all I would like to add a "premium" section to my wordpress blog and I would like to force users to click on a banner before being allowed to register to my blog, any step 2 step idea on how to solve this problem? The banner will be html or js. Thanks a lot to all!

share|improve this question

1 Answer 1

up vote 3 down vote accepted

This is a WAY open-ended question. I feel that if you did some research you'd find LOTS of answers. Here's how I would go about it.

Install or modify your code to use a members only plugin. Lock all the Non-Member pages. I'm confused on what you men by check a banner, but if the banner is just going to a registration page then block that page unless a query string something like example.net/register?banner=true has been set. If they go to example.net/register it would return false.

I'm not sure I answer your question like I said it's super open-ended. That's how I would do it. (if I understand the question)

EDIT:

You'll need to use a PHP $_SESSION or even a $_COOKIE to see if the user clicked the banner. I would do something like this.

Make a category "premium" and assign all preminum page to that category.

Add this to your functions.php in your theme

add_action( 'template_redirect', 'premium_redirect' );

function premium_redirect(){
   //see if post is in category of premium
   if(in_category('premium')){
        //see if the banner variable is set
        $banner_check =$_GET['banner'];
        //set the session (or cookie)
        if($banner_check == 'true'){$_SESSION['banner'] = 'true';}
        ///see if the $banner and the $_SESSION is set if not take them to the banner page
        if($_SESSION['banner'] != 'true'){
                 wp_redirect('http://example.net/bannerpage');
        }
     return;
    } //end cat check
return;
}

then have your banner link to example.net/premiumpage?banner=true

I haven't tested this but I us similar approaches all the time. You may also need to use a custom post type for pages instead of in_category see http://codex.wordpress.org/Conditional_Tags#A_Post_Type

share|improve this answer
    
what I wanna do is something like...Click on AdSense to login (not really AdSense because I know they will ban me but some ads that allow also incentivized traffic) –  Downloadtaky Apr 8 '11 at 10:16
    
Then my solution would work. You could also use $_SESSION or $_COOKIE and only show the login if whatever method you choose is true. –  BandonRandon Apr 9 '11 at 1:48
    
Also, I'm not going to give you a lecture on ethics but I think this is not an ethical way to have people access your site. Unless of course you state that VERY CLEAR in your terms. –  BandonRandon Apr 9 '11 at 1:49
    
This will be a new way to pay for premium contents :-) User only has to click (not to pay) Advertisers know that the clicks are incentivized (they like it) I earn a little money. No victims everyone wins :-) Could you please be a little more specific? I can't understand how to implement what you are telling to me (PHP almost Noob here) :P –  Downloadtaky Apr 12 '11 at 16:08
    
I just posted some example code. It's not prefect but gets you started. –  BandonRandon Apr 12 '11 at 23:01

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.