Closed Thread
Thread Tools Search this Thread
Unread 25th Jul 2015, 09:23 AM   #1
VIP Warrior
War Room Member
 
Join Date: 2002
Location: Over Yonder
Posts: 4,090
Thanks: 3,962
Thanked 5,961 Times in 2,860 Posts
Blog Entries: 1
Default
PHP Help Needed
Share on: 
fb share twitter share gplus share more share

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>

Members, check the rules before posting. To get support, post a new thread here.
Mark Singletary is offline  
Unread 26th Jul 2015, 06:54 AM   #2
VIP Warrior
War Room Member
 
Join Date: 2002
Location: Over Yonder
Posts: 4,090
Thanks: 3,962
Thanked 5,961 Times in 2,860 Posts
Blog Entries: 1
Default
Re: PHP Help Needed
Share on: 
fb share twitter share gplus share more share

Think I got it figured out. One of those "doh" moments.

Mark

Members, check the rules before posting. To get support, post a new thread here.
Mark Singletary is offline  
Closed Thread


Bookmarks

Tags
needed, php

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 01:55 AM.