1 replies
I'm hoping that some kind soul will have some words of wisdom to save what's left of my sanity. I am one of those guys that knows just enough PHP to screw everything up royally.

I'm trying to take a member's site backend to the next level by making some tweaks to improve the user experience. I'm using S2Member.

There is a membership option page that S2Member redirects anyone not allowed to see other content to. This page is also a sales letter.

What I want is if they get to the membership option page because they tried to see something they weren't allowed to then they get a message at the top of the membership page.

If they come across the page without first trying to access protected content they should not see the message.

Then I want them to to be redirected to the protected page once they login.

The code below works pretty well but there are a couple little bumps in the road.

If I come across the membership page without trying to access something protected first I do not get the "error" message. This works.

If I come across the membership page by trying to access something protected first I do get the error message. This works.

If I log in with the login URL it creates then I get automatically directed to the protected content. This works.

However, if I am logged in and go back to the membership page, I get the protected content error message. This should not be.

So I know that the table with the error message is not in the right place. But when I tried to put it in the PHP code and use the echo statement to display the table, I ran into a roadblock with the redirect after login URL that's in that table.

Any thoughts?

Thanks in advance.
Mark

Code:
<?php
if(!empty($_REQUEST["_s2member_vars"]))
    @list($restriction_type, $requirement_type, $requirement_type_value, $seeking_type, $seeking_type_value, $seeking_uri)
            = explode("..", stripslashes((string)$_REQUEST["_s2member_vars"]));

if (!empty($seeking_uri)) {
    $URI = base64_decode($seeking_uri);
}
?>

<table align='center' class='premiumcontenttable'><tr><td><strong>This premium content is available only to paid subscribers. Sign up for one of our premium subscriptions below or existing subscribers can <a href="<?php echo ( !empty($URI) ? wp_login_url( esc_url($URI) ) : wp_login_url() );?> " title="Login">Login</a> to access this page.</strong></td></tr></table>
#needed #php
  • Profile picture of the author Mark Singletary
    Think I got it figured out. One of those "doh" moments.

    Mark
    {{ DiscussionBoard.errors[10187521].message }}

Trending Topics