PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Member Level Re-direct & Link Visibility

s2Member Plugin. A Membership plugin for WordPress®.

Member Level Re-direct & Link Visibility

Postby bradjbarton » December 6th, 2011, 12:17 pm

Is it possible to re-direct a link to a specific page, other than the membership options page, when a link is clicked that would require a higher level membership to view the page?

I am setting up my membership area using the Optimize Press theme. The theme gives me good control over a number of things, but between s2Member and OP I cannot figure out how to re-direct a higher level link to a separate page (or OTO) where I can basically pitch something to the effect that tells the user that a higher level is required, with a bit of a pitch to upgrade. I am reasonably sure that this should be possible with s2Member, but I have been searching the forum over the last few days and cannot find anything about it.

Alternatively/additionally, is it possible to only display buttons or links in the members area that are only available to those that are at the defined level or above?
User avatar
bradjbarton
Registered User
Registered User
 
Posts: 20
Joined: December 1, 2011

Re: Member Level Re-direct & Link Visibility

Postby Eduan » December 6th, 2011, 12:29 pm

Well, from what I understand you want, is, that you want to redirect users to different membership options pages depending on their level.

If I understood correctly then you can check this video which talks about that:
http://www.s2member.com/paypal-modifica ... ons-video/

And you can check under WP Admin -> s2Member -> API / Scripting -> Simple/Shortcode Conditionals and Advanced/PHP Conditionals. You can check this video for more info:
http://www.s2member.com/advanced-conditionals-video/

Hope this helps. :)
Now officially accepting Professional s2Member installations along with Bruce C (a.k.a. Ace).

If you're interested in a Professional s2Member Installation, or a Custom Coding Job, you can send your request here.
User avatar
Eduan
Experienced User
Experienced User
 
Posts: 1154
Joined: August 27, 2011
Location: Taxco de Alarcón, Guerrero, México.

Re: Member Level Re-direct & Link Visibility

Postby bradjbarton » January 1st, 2012, 1:58 pm

Thank you for this reply Eduan. I watched the videos that you suggested and it has helped me to get farther down the path, but I now have a related issue that I cannot figure out. I have watched several more videos and researched other help files, but I am still having trouble.

I created the login welcome page using the Special Redirection URL, specifying a separate login welcome page for each level, as described in the first video. The Special Redirection URL is:

http://www.sitesteering.com/login-welcome-page-%%current_user_level%%

exactly as described in the video. This logic works beautifully and achieves the basic purpose. However, I am using a membership area header menu/nav bar because I need navigation to other sections of the members area. Each section includes grouped pages on different topics or functionality, etc.

The menu button that says Member Home Page has the URL:

http://www.sitesteering.com/login-welcome-page-%%current_user_level%%

but it is not a qualified URL and returns a 400 Bad Request error page. I have tried several variations, but all end up with the 400 error, 404 error, or redirect to the site home page.

What is the correct syntax for the qualified URL to the login welcome page when you are using the Special Redirection URL as shown here?
User avatar
bradjbarton
Registered User
Registered User
 
Posts: 20
Joined: December 1, 2011

Re: Member Level Re-direct & Link Visibility

Postby Cristián Lávaque » January 3rd, 2012, 5:50 am

That URL with the replacement code will only work in the s2Member field for the login redirection. WP Admin -> s2Member -> General Options -> Login Welcome -> Special Redirection

If you use that URL like that in your browser it will give you a 404 because it doesn't exist. /login-welcome-page-1 and /login-welcome-page-0 will exist if you created them, though, so you need to use those.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Member Level Re-direct & Link Visibility

Postby bradjbarton » January 5th, 2012, 11:51 am

I figured out that it would not work as is, that's why I made this post. I need to add child pages to each of the different level login welcome pages, so that those pages only are seen by the correct logged in level user. This is also why I can't use the single page method where only user level content is displayed - well, I guess I could but I would be using content space (rather than menu space - kind of tacky) for the links to the other section pages.

There are also main menu items that are common to all 6 levels. This means that I need to use a header menu for the common sections, and the side bar menu for the logged in level specific content pages that are child to the login welcome page itself. When I create a child page to the login welcome page the theme automatically populates the side bar menu with the pages. Because each level has it's own login welcome page, and header menu selections can take the user away from the main login welcome page section, the user needs a way to get back to it - either by link or menu button. Otherwise, the user is left with using the back button to find the login welcome page.

So, how can this be accomplished? Can I make the menu link to the login welcome page go to a special page where the php code would decipher the user's correct level and then redirect to the correct login welcome page? If so, what is the php code I would need for that re-direction login welcome page? Any other ideas how this can be achieved?
User avatar
bradjbarton
Registered User
Registered User
 
Posts: 20
Joined: December 1, 2011

Re: Member Level Re-direct & Link Visibility

Postby Raam Dev » January 5th, 2012, 6:37 pm

There seems to be two things being discussed in this thread: One about the Membership Options Page and one about the Login Welcome Page.

I can answer your original question about redirecting users away from the Membership Options page and to a specific page designed to "sell" them a specific item.

When a user tries to access a post/page protected by s2Member, the user is redirected to the Membership Options page. When they're redirected, there are a bunch of variables included in the redirect (you can see these in the URL after the redirect).

These extra variables say which page the user was attempting to access. So, if we use some PHP, we can check these variables and redirect them again (away from the Membership Options Page) to another page specifically designed for the post/page they were trying to access.

This thread explains how I achieved this: viewtopic.php?f=4&t=14947#p53487

Does that help?
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: Member Level Re-direct & Link Visibility

Postby bradjbarton » January 7th, 2012, 11:28 am

Thanks Raam, I should have been a bit more clear than simply referring you to this thread. Some things I had sort of figured out over time and the earlier replies, but your thread reference helped to clarify the redirection issue to the member options page.

I am down to trying to figure out how to direct an HTML link in a menu button to this variable:

http://www.sitesteering.com/login-welcome-page-%%current_user_level%%

for the reasons mentioned in my January 5 post. I don't care how it is done, as long as I can do it. For example, even if I needed another page for the sole purpose of redirection I could use the link to that redirection page in the menu buttons. This solution may be similar to your solution to the redirection issue to the member options page, but in this case I simply need to parse out their logged in level and deliver them to the correct login welcome page.
User avatar
bradjbarton
Registered User
Registered User
 
Posts: 20
Joined: December 1, 2011

Re: Member Level Re-direct & Link Visibility

Postby Raam Dev » January 7th, 2012, 7:41 pm

You can do that with PHP using the s2Member Constant S2MEMBER_CURRENT_USER_ACCESS_LEVEL (see WP Admin -> s2Member -> API/Scripting -> s2Member PHP/API Constants):

Code: Select all
<a href="http://www.sitesteering.com/login-welcome-page-<?php echo S2MEMBER_CURRENT_USER_ACCESS_LEVEL;?>">Link text goes here</a>


Assuming the currently logged in user's level is 4, that code will generate a link that goes to http://www.sitesteering.com/login-welcome-page-4.

Is that what you're looking for?
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: Member Level Re-direct & Link Visibility

Postby bradjbarton » January 7th, 2012, 9:01 pm

Well, we are finally closer. I need to copy and paste into the URL box of a menu button, not use a link from a page. I need the same as if you were typing into the address bar of a browser, because that is basically what happens when you click the menu button.

When I paste the URL portion into the URL box of the menu button, only this is saved:

http://www.sitesteering.com/login-welco ... ESS_LEVEL;?

It is missing brackets and spaces, etc., and it does not work. I just need whatever the URL would be that will redirect to the correct page based on logged in user level.
User avatar
bradjbarton
Registered User
Registered User
 
Posts: 20
Joined: December 1, 2011

Re: Member Level Re-direct & Link Visibility

Postby Eduan » January 7th, 2012, 9:11 pm

Try this instead:
<a href="http://www.sitesteering.com/login-welcome-page-<?php echo S2MEMBER_CURRENT_USER_ACCESS_LEVEL; ?>">Link text goes here</a>

Please tell me how it goes.
Now officially accepting Professional s2Member installations along with Bruce C (a.k.a. Ace).

If you're interested in a Professional s2Member Installation, or a Custom Coding Job, you can send your request here.
User avatar
Eduan
Experienced User
Experienced User
 
Posts: 1154
Joined: August 27, 2011
Location: Taxco de Alarcón, Guerrero, México.

Re: Member Level Re-direct & Link Visibility

Postby bradjbarton » January 8th, 2012, 12:01 am

The example that Raam gave, just above, works perfectly when inserted into the HTML of a page. I need to know the URL that can be typed into a browser address bar to achieve the same result. It appears that PHP does not survive as a URL address, which doesn't surprise me.

Image

I need to type the URL and link text into 2 separate fields. I cannot copy and paste the entire line of PHP into the URL field because it does not save it accurately. As I mentioned earlier, there may be a way for a separate page to parse this correctly based upon logged in user level and redirect to the correct page. If that is true, I could simply use The URL for the redirector page in the URL field of the menu.

I am a little surprised that this was not a common issue, long since resolved, and included in a thread somewhere. Perhaps I just didn't know how to explain it accurately.
User avatar
bradjbarton
Registered User
Registered User
 
Posts: 20
Joined: December 1, 2011

Re: Member Level Re-direct & Link Visibility

Postby Raam Dev » January 9th, 2012, 12:36 am

To set up a redirect, you can create a page with the following code (you must have the PHP Execution installed):

Code: Select all
<?php if(is_user_logged_in()) { ?>
<script type="text/javascript">
<!--
window.location = "http://www.sitesteering.com/login-welcome-page-<?php echo S2MEMBER_CURRENT_USER_ACCESS_LEVEL?>";
//-->
</script>
<?php } else { ?>
You must be logged in for this redirect to work... 
<?php ?>


(Keep in mind this redirect won't happen for anyone who has JavaScript disabled in their browser.)
Last edited by Raam Dev on January 9th, 2012, 11:29 pm, edited 1 time in total.
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: Member Level Re-direct & Link Visibility

Postby bradjbarton » January 9th, 2012, 11:24 pm

I set up a page, copied and pasted the code, but it displays that page as a blank page and does not redirect. I do have PHP Execution installed and activated. I tested in Firefox and IE, both have Java enabled. I tested logged in as admin and as a level 1.

Am I beating a dead horse?
User avatar
bradjbarton
Registered User
Registered User
 
Posts: 20
Joined: December 1, 2011

Re: Member Level Re-direct & Link Visibility

Postby Raam Dev » January 9th, 2012, 11:29 pm

Whoops, there was an error in my code (I was missing the closing bracket). Can you copy/paste from my code example and try again?
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: Member Level Re-direct & Link Visibility

Postby bradjbarton » January 9th, 2012, 11:58 pm

Perfect! Thanks for your perseverance Raam.
User avatar
bradjbarton
Registered User
Registered User
 
Posts: 20
Joined: December 1, 2011

Re: Member Level Re-direct & Link Visibility

Postby Raam Dev » January 11th, 2012, 11:50 am

You're most welcome! :)
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: Member Level Re-direct & Link Visibility

Postby jlamarferren » January 18th, 2012, 11:29 am

Just what I was looking for :)
User avatar
jlamarferren
Registered User
Registered User
 
Posts: 30
Joined: August 26, 2011


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron