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™

Free Registration @ Different Levels

s2Member Plugin. A Membership plugin for WordPress®.

Free Registration @ Different Levels

Postby Jason Caldwell » October 2nd, 2010, 12:11 pm

s2Member deals with Levels [0-4]. These Levels are detected automatically during Registration. In other words, the Registration Form is adjusted automatically, based on the Level that a Customer purchases access to. As of s2Member v3.2.7+, you can also configure Custom Fields at different Levels, so the Registration Form will change in appearance if/when you have different Fields configured.

Now, if it's a free Registration, s2Member always defaults to Level # 0 ( a Free Subscriber ). So this works perfectly. However, in some cases, you may wish to offer Free Membership at multiple/different Levels, instead of Level #0 by itself. Since s2Member expects Levels 1-4 to be "paid for", you will have to link to the Registration Form in a more "advanced way" if you intend to offer these Levels [1-4] for free.

You can use this function to create a link that will allow "Paid Registration Access" for "Free" instead of requiring a Customer to go through PayPal®. This same function is often used by other gateways providers that intend to interface with s2Member, so you can adapt this to your situation; as needed.

Code: Select all
$link = ws_plugin__s2member_register_link_gen
($subscr_id, $custom, $item_number, $shrink);  

$subscr_id = the paid transaction ID, or just a dash (-) if there was no transaction.
$custom = $_SERVER["HTTP_HOST"] ( must match the domain hosting the s2Member installation )
$item_number = 1,2,3 or 4 ( the Level number that a Customer will go in as during registration )
$shrink = ( false ) return the URL in full format, or ( true / return a tinyURL for emailing ).


Sending a Customer to the link produced by this function, will ultimately set three encrypted cookies, that s2Member will read in automatically, and ALLOW registration temporarily ( one time ).

Additional details ( optional ).

$item_number could also include
Custom Capabilities, and/or a fixed term length.

$item_number = 1,2,3, or 4
-- OR --
$item_number = level:custom capabilities:fixed term
( ex: 1:music,videos:1 M )

Which means:
Level #1 access, + music,videos as Custom Capabilities - account expires in 1 month.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Free Registration @ Different Levels

Postby Jason Caldwell » October 2nd, 2010, 12:11 pm

Here is more of a real-world example of how this might be implemented on your site.
Inside the functions.php file for your WordPress® theme, insert a snippet like this:
Code: Select all
add_action("init""register_level");
function 
register_level(){
    if(
$_GET["register_level"]){
        
$link ws_plugin__s2member_register_link_gen ("-"$_SERVER["HTTP_HOST"], $_GET["register_level"], false);
        
wp_redirect($link);
        exit;
    }
}   

Here are how the actual links would be formulated:
Code: Select all
http://example.com/?register_level=1
http://example.com/?register_level=2
http://example.com/?register_level=3
http://example.com/?register_level=4
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Free Registration @ Different Levels

Postby jhg03 » October 5th, 2010, 2:52 pm

How would I work that into the paypal-pro-registration-form.html file (to register for free as a level 4 member)?

Thank you!
User avatar
jhg03
Registered User
Registered User
 
Posts: 19
Joined: August 31, 2010

Re: Free Registration @ Different Levels

Postby x3000gold » November 30th, 2010, 4:28 am

Hi,

This solved my problem! Im sooo glad :)
User avatar
x3000gold
Registered User
Registered User
 
Posts: 36
Joined: November 3, 2010

Re: Free Registration @ Different Levels

Postby SantiAzpi » November 30th, 2010, 6:14 am

Wow, I am impressed, Jason! After months of playing with WP, I finally begin to get how hooks work...

Very good example, thank you!
User avatar
SantiAzpi
Registered User
Registered User
 
Posts: 13
Joined: November 22, 2010

Re: Free Registration @ Different Levels

Postby x3000gold » December 12th, 2010, 3:37 pm

When I use WP Super Cashe this do not work any more. Is there any way around this?

Please help me!
User avatar
x3000gold
Registered User
Registered User
 
Posts: 36
Joined: November 3, 2010

Re: Free Registration @ Different Levels

Postby stowe39 » February 15th, 2011, 5:15 am

I am trying to set up s2 member on my test webserver with levels 1,2,and 3 as paid levels and have level 4 function as a "free 1 day trial"

I've changed the code in functions.php to

Code: Select all
add_action("init", "register_level");
function register_level(){
  if($_GET["register_level"]){
    $link = ws_plugin__s2member_register_link_gen ("-", $_SERVER["HTTP_HOST"], "4:1D", false);
    wp_redirect($link);
    exit;
  }
}


and the link in wp is
Code: Select all
http://localhost/wordpress/?register_level=4


But when I sign up a test user, they show up as a "subscriber" in the users list instead of as a "S2Member Level 4"

I think I've got a syntax error in function register_level() code.... does anyone know how to code it so it works?

Thanks

Kym
User avatar
stowe39
Registered User
Registered User
 
Posts: 22
Joined: February 15, 2011


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 0 guests

cron