Page 1 of 1

Making restricted pages send users to registration page

PostPosted: June 25th, 2010, 9:59 am
by seacoast
I want to block a section of my site I do not control (feed generated). I am able to block the section after blocking a specific http://www.example.com/example2/ url.

My question, is there away to make it direct to the login page?

Second question, is there away to make it direct to the login page after so many seconds have gone by?


Thanks!

Re: Making restricted pages send users to registration page

PostPosted: June 26th, 2010, 1:59 am
by Jason Caldwell
Yes, you can add this to the functions.php file for your theme.

Code: Select all
add_action("template_redirect", "redirect_membership_options_to_login");

function redirect_membership_options_to_login(){
    $mop = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
    if($mop && is_page($mop) && isset($_GET["s2member_level_req"])){
        header("Location: " . wp_login_url()); exit;
    }
}

Re: Making restricted pages send users to registration page

PostPosted: June 26th, 2010, 2:00 am
by Jason Caldwell
Second question, is there away to make it direct to the login page after so many seconds have gone by?

Sure. Please explain exactly what you're trying to accomplish though.
There are few different things, but it depends on what you're trying to do exactly.

Re: Making restricted pages send users to registration page

PostPosted: June 26th, 2010, 12:00 pm
by seacoast
Your awesome.

I have a real estate website that uses an idx feed. My goal is to allow readers to view the first couple pages first, but after that be required to login. This means that I do not turn away first visitors, but that I can still capture leads... higher quality than if I made everyone sign up.

Also... do you have a place I can donate? I don't think I have a need for the "premium" s2member plugin, but would still like to contribute.

Thanks!

Re: Making restricted pages send users to registration page

PostPosted: June 27th, 2010, 7:29 am
by Jason Caldwell
Thank you very much the kudos!

I have a real estate website that uses an idx feed. My goal is to allow readers to view the first couple pages first, but after that be required to login. This means that I do not turn away first visitors, but that I can still capture leads... higher quality than if I made everyone sign up.

OK, I see what you're trying to accomplish. Let me soak on that one for a bit. I'll get back to you.

@TODO - Delayed access control hack/code snippet/feature.. : soaking.

Also... do you have a place I can donate? I don't think I have a need for the "premium" s2member plugin, but would still like to contribute.

Yes, that is very nice of you to ask.
http://www.primothemes.com/donate/