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™

I need different redirections after login?

s2Member Plugin. A Membership plugin for WordPress®.

I need different redirections after login?

Postby Berny-T » August 29th, 2011, 4:06 am

Dear Forum.

In the moment I am testing s2member. Generally It works fine - unfortunately it is not realy easy for a Newbie to getting it work because there are so many features ;-)

And: in the past I tested many Membership plugins with paypal integration: s2member is the only one "free of charge" plugin that works. Thanks to the developer!

The story to my problem:

I have two kinds of users: pay user and customers. The main difference is:

    Pay user: they have to pay to see some content. I have two levels: "Basic" and "Expert". After the login the user is redirected to a special site - for every level I created a dedicated landing site. I solved this by using the s2member variables: f.e: http://www.mydomain.com/member/level-site-%%level%%. Where the %%level%% is the number from s2member (1,2,3,4) - a great feature.
.
    Customer: They bring me the content. After a customer logged in he gets his personal site and NOT (!!) the redirected landing site from s2member. f.e. the customer "hugo" has his own site with the url: http://www.mydoamin.com/customer/hugo. In the past I solved this with the Plugin "Peter's Redirect" - a very cool solution.


My problem:

After activation from s2member, this plugin overrides the rules from "Peter's Redirect" and all the redirections for my customer (defined by Peter's Redirect) doesn't work anymore - grrrrrr.

My question:

Does anybody know a solution to use "individual" redirections despite using s2member?

Thank you in advance for your answers.
User avatar
Berny-T
Registered User
Registered User
 
Posts: 4
Joined: August 29, 2011

Re: I need different redirections after login?

Postby man-O-media » August 29th, 2011, 8:44 am

One way would be to have them first land on the My Profile Page after login.
If you create a new template for the profile page instead of the default to build that with you can make use of the many S2 contstants and shortcodes in the HTML view of that page as well as full php code embedded in the template to create user specific links to send them where they need to go.

You could sell this as a feature by making it their dashboard both for account maintenance and access to the rest of their specific area.


DP
User avatar
man-O-media
Experienced User
Experienced User
 
Posts: 117
Joined: February 10, 2011

Re: I need different redirections after login?

Postby cassel » August 29th, 2011, 9:25 am

Maybe this post could help: viewtopic.php?f=4&t=14376&start=50#p30766
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: I need different redirections after login?

Postby Berny-T » August 29th, 2011, 3:14 pm

@man-O-media: Thanks. That's no way for me - sorry for that. I need completely different landing pages for "customers" and "pay user".

@cassel: Thanks. I think the way is "ok". But my requirements are quit difficult. I will show this with some examples:

After the login the customers and pay users will redirected by the following rule

Customer "hugo" (a customer): http://www.mydomain.com/hugo
Customer "otto" (a customer): http://www.mydomain.com/otto
Customer "merlin" (a customer): http://www.mydomain.com/merlin
Customer "bill" (a customer): http://www.mydomain.com/bill
Customer "steve" (a customer): http://www.mydomain.com/steve

=> This means: every customer has his own (!) page. In this case I need 5 different landing pages.

User "harry" (a basic pay user): http://www.mydomain.com/basic
User "don" (a basic pay user): http://www.mydomain.com/basic
User "elton" (a basic pay user): http://www.mydomain.com/basic

User "sam" (a expert pay user): http://www.mydomain.com/expert
User "caesar" (a expert pay user): http://www.mydomain.com/expert
User "zanetti" (a expert pay user): http://www.mydomain.com/expert

=> This means: every level has his own (!) page. In this case I need 2 different landing pages.

For this case (and my opinion) I need 7 redirections.

How to integrate this via script in the header. "Unfortunately" I have more than 5 customers ;-)

Is it possible to solve my problem with the PRO version?

Regards Hans
User avatar
Berny-T
Registered User
Registered User
 
Posts: 4
Joined: August 29, 2011

Re: I need different redirections after login?

Postby Cristián Lávaque » August 29th, 2011, 4:43 pm

So you have the Login Welcome Page set to http://mydomain.com/level-site-%%level%% right?

This'd mean that you should create one Login Welcome Page for each level your members can be: 0, 1 and 2.

http://mydomain.com/level-site-0
http://mydomain.com/level-site-1
http://mydomain.com/level-site-2

Each one should be restricted at the level they're meant for. WP Admin -> s2Member -> Restriction Options -> Page

But if you want a user from one level to see the site for a lower level, you'll need to use a conditional because Access Restriction doesn't work that way, levels have incremental access and each will have access to its level and below. WP Admin -> s2Member -> API / Scripting -> Simple/Shortcode Conditionals -> Example #3

Now, level-site-1 would be for Basic paid members and level-site-2 for Expert paid members. So far, so good.

You want the Level 0 users to be shown their personal page, though, right? Then in level-site-0 you can use a redirection to it (you'll need a PHP execution plugin https://wordpress.org/extend/plugins/exec-php/ and use the HTML editor only). E.g.

Code: Select all
<?php header('Location: http://mydomain.com/' . $username); ?>


You'd replace $username with the var that has the name you need for the URL.

I hope that makes sense. :)
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: I need different redirections after login?

Postby Berny-T » August 31st, 2011, 3:44 am

Thanks for your fast answer. I'll try it in the next days and will give you a feedback.
User avatar
Berny-T
Registered User
Registered User
 
Posts: 4
Joined: August 29, 2011

Re: I need different redirections after login?

Postby Berny-T » August 31st, 2011, 11:00 am

Ok, here I am again.

The first part works fine:

Level 0 Members will redirected to the level-0 page and
Level 1 Members will redirected to the level-1 page.

I'm feeling so great that i brought home the bacon ;-)

The second part makes me unsure:

I insert the code
Code: Select all
<?php header('Location: http://mydomain.com/' . $username); ?>
into the page.

Sorry, I don't understand what you mean with
You'd replace $username with the var that has the name you need for the URL.


Could you explain this to me a bit more ... I'm not a programmer ;-)

Ok. After I inserted the code I saved the page and tested the result. I get the following message:

! Warning: Cannot modify header information – headers already sent by (output started at /homepages/.../wp-content/themes/.../header.php:2) in /homepages/.../wp-content/themes/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 5


I 'm afraid that the problem is the "var" in your code. I have tested other php scripts inside this page and they work fine.

Thank you in advance for your help.

Regards Hans
User avatar
Berny-T
Registered User
Registered User
 
Posts: 4
Joined: August 29, 2011

Re: I need different redirections after login?

Postby Cristián Lávaque » August 31st, 2011, 10:42 pm

Glad you got the first part working. Well done. :)

About the error, it's because the code uses header when it's too late in the script. Try instead using a JavaScript redirection then, for example:

Code: Select all
<?php echo '<script type="text/javascript">window.location = \'http://mydomain.com/' . S2MEMBER_CURRENT_USER_LOGIN . '\';</script>'; ?>



I hope that helps.
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


Return to s2Member Plugin

Who is online

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

cron