latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Redirect Question

Home Forums Community Forum Redirect Question

This topic contains 11 replies, has 4 voices. Last updated by  Jason (Lead Developer) 4 years, 10 months ago.

Topic Author Topic
Posted: Saturday Feb 18th, 2012 at 8:27 am #5575

I have three levels of membership. When a member tries to access content not available to their level, I want to redirect them to the login welcome page instead of the membership options page. How do I do this?

List Of Topic Replies

Viewing 11 replies - 1 through 11 (of 11 total)
Author Replies
Author Replies
Posted: Saturday Feb 18th, 2012 at 12:31 pm #5589
Eduan
Username: Eduan
Moderator

Hello Carl, thanks for your inquiry.

Currently this is not possible by default with s2Member, without some tricks. ;) (No coding involved.)

First, go to WP Admin -> s2Member -> General Options -> Login Welcome Page. In there, leave the field to select the page empty, and under that you will see a field that goes something like “Or, you may configure a Special Redirection URL, if you prefer.”, or something along those lines, in there, paste the full URL of the Membership Options Page that you wish to use.

Now, under WP Admin -> s2Member -> General Options -> Membership Options Page select the page that you wish to use as the Membership Options Page.

Please tell me how it goes, and I hope this helps. :)

Posted: Saturday Feb 18th, 2012 at 12:52 pm #5590

Thank you for your response. I’m not sure I understand, however. The solution you suggested seems like it would still redirect members who try to access content that is restricted by their level to the membership options page. For example, when a level one member who is logged in tries to access a level three area, it redirects them to the membership options page. I want it to redirect them to the login welcome page, not a signup page.

Posted: Saturday Feb 18th, 2012 at 1:09 pm #5595
Eduan
Username: Eduan
Moderator

Hello Carl, thanks for the follow-up.

Yes I’m sorry, it seems I misunderstood a little, you will configure both of these options to point to the Login Welcome Page, not the Membership Options Page.

It should look something like this:

Hope this helps. :)

Posted: Saturday Feb 18th, 2012 at 3:56 pm #5611

Okay, I think we might be closer, but I still want people who are not members to be redirected to the membership options page. Won’t this affect that?

Posted: Saturday Feb 18th, 2012 at 4:18 pm #5613
cassel
Username: cassel

At the base, when a member is not logged in, s2M cannot say whether they are supposed to be a level 1 or level 3 member or not a member at all, so unless the member IS logged it, i dont think s2M will know to direct them to a different page.

  • This reply was modified 4 years, 10 months ago by  cassel.
Posted: Saturday Feb 18th, 2012 at 4:40 pm #5617

I think maybe the problem is that I am just not stating it very well. Let me try again.

When someone visits my site who is not a member, they get redirected to the membership options page. In other words, the only content they will see until they sign up is that page. This is fine. That’s where I want them to go so they can sign up.

When a member is logged in and browsing my site and they try to access content that is restricted (example: a Level 1 member attempts to access a Level 3 page) they also get redirected back to the membership options page. This is not fine. I either want them to see the welcome page or a page which says Your membership level does not allow you to access this page.

Maybe that makes more sense. I know there has to be a way to do this. Having someone who is already a member getting redirected back to the membership options page is just sloppy.

Posted: Saturday Feb 18th, 2012 at 4:52 pm #5618
cassel
Username: cassel

I have that sort of redirect on my site. I have two sales pages and if someone already has purchased those courses (and they are logged in), they are redirected to the index of that course. Maybe this can help you?
Here is what i used:

window.location = ‘http://scrapbookcampus.com/welcome-to-the-basic-scrapping-course/’;

I am not using levels in my site, but just ccaps, but it is the same principle. In this example,
– if a visitor comes, or a non-logged member, they will see the sales page where this code is place because it does not meet either of the two first requirements
– if a member comes, is logged but has a different ccap, he will see the sales page also because it does not meet the requirements
– if a logged in member, with the correct ccap (called “basic” in this case), then, instead of the page he was trying to reach (the sales page), he will be directed to the “welcome to the basic scrapping course” page, which is the index of the course (no point in pitching the sale again)

Then, i also put the “matching” code in the course index page, in case someone would find the direct link to it, and tries to access it without the proper requirement.

BTW, the mention of the administrator is a great little detail to add so that you, as an admin, CAN view either page and NOT get redirected whichever page you want to view (essential when you are formatting your page!).

Hope this helps.

Posted: Saturday Feb 18th, 2012 at 5:00 pm #5619

Well, that is definitely more info than I had. I appreciate your time and effort in making that response. So, what you’re telling me is that I’m going to have to code this. Ccap, etc….Greek to me. Great. It does disappoint me that S2Member cannot provide a simpler method to redirect members/non-members. That is basically all I want to do. Non-paying members see the Membership Options Page….Paying members see the Welcome Page on a redirect. That seems like something S2Member could have incorporated very easily without all this need for coding.

Posted: Saturday Feb 18th, 2012 at 5:25 pm #5621
cassel
Username: cassel

I actually realized that i didn’t enclose the code in a code format so what i showed you didn’t display correctly. It was supposed to be this:

window.location = 'http://scrapbookcampus.com/welcome-to-the-basic-scrapping-course/';

S2M is very powerful and the ccaps is one of the most powerful feature, combined with the conditionals. I am NOT a developper, and i am NOT a coder (even HTML is foreign language for me). The logic is very simple, and the coding, once you have it, is also simple. There is a video explaining the use of the conditionals here:
http://www.s2member.com/videos/D415163AD094991B/?tw_p=twt

The ccap is not necessary for you if you are using levels. In my site, it is just not what i need. So, to recapitulate, here is what you might be looking for:

on your level 3 page, you can add something like this on top



   window.location = 'http://theotherpage';

Which simply translates:
If the current user cannot access level3
send him to this other page

Check the API /Scripting > Advanced/PHP conditional for many examples. It looks like jibberish at first, trust me, but when you know how it works, it gives you much more flexibility than any “simple” button possibly built in the s2M itself.

  • This reply was modified 4 years, 10 months ago by  cassel.
Posted: Saturday Feb 18th, 2012 at 5:32 pm #5623
cassel
Username: cassel

OK, there seems to be a big problem is displaying the code as i am typing it. It is NOT looking like it did when i typed it, nor when i previewed it. Let’s hope someone can figure out how to display my code properly. If not, i’ll send you a message, ok?

I cannot even find a way to send you a direct message with this new board. I’ll look around for that. The redirect is very simple and so are the conditionals. It is just like algebra: simple basics but you can make it as complicated as you want after!

  • This reply was modified 4 years, 10 months ago by  cassel.
Posted: Monday Feb 20th, 2012 at 6:54 pm #5749
Staff Member

Thanks for the heads up on this thread.

I have three levels of membership. When a member tries to access content not available to their level, I want to redirect them to the login welcome page instead of the membership options page.
How do I do this?

I would recommend using s2Member’s MOP Vars to handle this.

If you look in your Dashboard under:
s2Member -> API Scripting -> Membership Options Page Variables (MOP Vars),
you will find documentation about the details s2Member passes to your Membership Options Page whenever a redirection occurs. You can use these details to intercept that redirection, and perhaps redirect to a custom location based on a multitude of factors that you design.

Viewing 11 replies - 1 through 11 (of 11 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.