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.

Help – How do you Redirect to alternate page

Home Forums Community Forum Help – How do you Redirect to alternate page

This topic contains 5 replies, has 2 voices. Last updated by  Andy Knott 4 years, 6 months ago.

Topic Author Topic
Posted: Tuesday Jun 12th, 2012 at 11:56 am #16261

Hi,

I am sure this will be found and thought of as a pretty noddy question.

I am trying to redirect members already signed up to a alternate page other than the membership options page. I am sure I have seen this. However I have spent the last 5 hours trying to find it to no avail.

So to recap, I have signed up members and if they select a product that is not part of their membership at the moment they are redirected to the membership options page. I want only members to be redirected to an upgrade page. This page should not be visable to the outside world and as normal the membership options page will be the default page that non-members are directed to.

Hope that makes sense

Thanks is anticipation of a quick response.

Adrian

  • This topic was modified 4 years, 6 months ago by  Adrian Clark.
  • This topic was modified 4 years, 6 months ago by  Adrian Clark.

List Of Topic Replies

Viewing 5 replies - 1 through 5 (of 5 total)
Author Replies
Author Replies
Posted: Saturday Jun 16th, 2012 at 10:48 am #16676
Andy Knott
Username: Me

Hi…

I too am looking for similar functionality and can’t seem to find a solution/option within s2Member.

Rather than products (as Adrian’s above) I have a number of different membership levels and have managed to split them up individually i.e. Level 1 membership has access to Level 1, Level 2 membership has access to Level 2 membership etc.

What I’m trying to do is if Level 1 tries to view some Level 2 content they get redirected to an upgrade page which gives them the option to upgrade to Level 2.

Also hope that makes sense. Don’t think it’s a million miles away from Adrian’s issue.

Any help greatly appreciated.

Andy

Posted: Monday Jun 18th, 2012 at 1:42 pm #16778

Hi Andy,

As there was no answer forthcoming I decided to change things around a little.

The solution I came up with was to create a new page called “Membership Upgrade” with all the upgrade options on. So level 2 and level 3 from level 1.

Then I made this page the “Membership Options Page”. Confused yet…

I then left the “Membership Options Page” as it was with all membership signups and also left it as a link at the bottom of the main sales page.

Yes I can hear you say that this is not really a good solution, however on the basis that no one else responded and I needed the solution quick, I felt it was not a bad idea.

Posted: Thursday Jun 21st, 2012 at 6:52 am #17086
Andy Knott
Username: Me

Thanks Adrian…

I’m going to try and research further. If I find anything that works I’ll post it here.

Thanks for sharing.

Andy

Posted: Thursday Jun 21st, 2012 at 7:40 am #17102
Andy Knott
Username: Me

Hi Adrian… OK. This is what I’ve done and it seems to be working.

Step 1

I have 2 separate membership levels: Level 1 and Level 2. Level 1 can only access Level 1, level 2 can only access Level 2. Access to the levels are controlled by categories and tags, so if I either tag a piece of content with the tag ‘level1’ or place a piece of content in ‘level1’ category only Level 1 users will be able to see it.

I create ‘level1’ category and tag, and then ‘level2’ category and tag within WordPress

I’ll go on and explain how you get to sign up users and assign the relevant tags and categories to them.

Step 2

In the theme’s functions.php I added the following code:

#—————————————————————–
# Custom Capabilities
#—————————————————————–

add_action (“template_redirect”, “my_custom_capabilities”);

function my_custom_capabilities ()

{

if(has_tag(“level1”) && !current_user_can (“access_s2member_ccap_level1”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}

else if(has_category(“level1”) && !current_user_can (“access_s2member_ccap_level1”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}

else if(has_tag(“level2”) && !current_user_can (“access_s2member_ccap_level2”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}

else if(has_category(“level2”) && !current_user_can (“access_s2member_ccap_level2”))
{
header (“Location: “. S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
exit ();
}

}

Step 3

I use PayPal Pro Forms to sign up members… Below is an example of the form/code I used in a page for signing up a user for Level 1 and again for level 2.

[s2Member-Pro-PayPal-Form level="1" ccaps="level1" desc="£14.95 GBP / Monthly ( recurring charge, for ongoing access )" ps="paypal" lc="" cc="GBP" dg="0" ns="1" custom="yourdomain.com" ta="0" tp="0" tt="D" ra="14.95" rp="1" rt="M" rr="1" rrt="" rra="2" accept="paypal,visa,mastercard,amex,discover,maestro,solo" accept_via_paypal="paypal" coupon="" accept_coupons="0" default_country_code="" captcha="0" /]

and for level 2

[s2Member-Pro-PayPal-Form level="1" ccaps="level2" desc="£14.95 GBP / Monthly ( recurring charge, for ongoing access )" ps="paypal" lc="" cc="GBP" dg="0" ns="1" custom="yourdomain.com" ta="0" tp="0" tt="D" ra="14.95" rp="1" rt="M" rr="1" rrt="" rra="2" accept="paypal,visa,mastercard,amex,discover,maestro,solo" accept_via_paypal="paypal" coupon="" accept_coupons="0" default_country_code="" captcha="0" /]

Step 4

I created a page called ‘Upgrades’

Step 5

In S2Member>General Options>Membership Options Page, I chose the ‘Upgrades’ page from the ‘Membership Options Page:’ drop down list.

Outcome

So now when a Level 1 member tries to view any content either tagged or categorised as ‘Level 2’, they get sent to the ‘Upgrades’ page… and vice versa.

To Do

Now I’ve just got to work out what to put on the upgrades page to upgrade a membership!!! Might have to do that process manually via payPal to increase the monthly sum and then add the additional tag/category into the user’s profile.

Hope that made sense!

Posted: Thursday Jun 21st, 2012 at 7:53 am #17105
Andy Knott
Username: Me

Re: upgrading. In the admin backend if you choose Users>All Users and then edit a user/member you’ll find a field called ‘custom capabilities’. In here will be the membership level signed up for.

i.e. I have a user with ‘level1’ in their custom capability form. If I now change that to ‘level1,level2’ they now have access to Level 2. If I change it to ‘level2’ only, they’ll have access to Level 2 but not Level 1.

As my brain is now hurting, I think what I’m going to do is create a form (using gravity forms so I can pre-populate some user data like first and surname) and stick it in the Upgrades page, so that they request/send a message to upgrade. I’ll then change manually via the custom capability form (above) and PayPal manually.

Cheers…

Viewing 5 replies - 1 through 5 (of 5 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.