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 = c_ws_plugin__s2member_register_access::register_link_gen
($subscr_gateway, $subscr_id, $custom, $item_number, $shrink);
$subscr_gateway = the paid subscription gateway code ( usually: paypal ).
$subscr_id = the paid transaction ID, or use time() 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 four encrypted cookies, that s2Member will read in automatically, and ALLOW registration temporarily ( one time ).
Additional details ( optional ).
$subscr_gateway ( possible values )
paypal, authnet, google, clickbank, alipay, ccbill
( or use a custom gateway value: my-gateway )
( or you can just use the word: none )
$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.