Statistics: Posted by Cristián Lávaque — April 22nd, 2011, 9:34 pm
Statistics: Posted by ashopsoftware — April 22nd, 2011, 8:57 pm
Statistics: Posted by Cristián Lávaque — April 22nd, 2011, 2:58 pm
Statistics: Posted by gregtampa — April 22nd, 2011, 1:51 pm
"s2member\includes\classes\register-access.inc.php"(22,15): Generates registration links.
"s2member\includes\classes\register-in.inc.php"(22,13): Handles registration links.
"s2member\includes\classes\register.inc.php"(22,13): Handles registration links.
Statistics: Posted by Cristián Lávaque — April 22nd, 2011, 1:42 pm
"Hi,
It appears that the function to generate registration links, which is required for the AShop integration, has been completely removed in newer versions of s2member. The version that was used for the AShop integration is 3.2.7. Using later versions will not currently work.
I will check with Primo Themes (the makers of s2member) if they have added a new way to do this to their software and try to get it running in AShop as soon as possible.
Thank you for bringing this to my attention!
Best regards,
Andreas Rimheden
www.ashopsoftware.com
"
Statistics: Posted by gregtampa — April 22nd, 2011, 10:35 am
Statistics: Posted by Cristián Lávaque — April 21st, 2011, 2:19 pm
Statistics: Posted by gregtampa — April 21st, 2011, 2:01 pm
Statistics: Posted by Cristián Lávaque — April 21st, 2011, 1:49 pm
2.26.10 S2Member
The free s2member plugin for Wordpress can be used to run a membership site where some content is
only available to paying members. You can configure 4 different levels of memberships to give access to
different parts of your website depending on what type of membership your customers have bought.
AShop can be used to sell access to multiple s2member sites through the s2member fulfilment module.
Prepare the Wordpress site
First of all you need to install the s2member plugin on your Wordpress site and configure it. How to do
this is explained in the s2member documentation. Next, you need to prepare your Wordpress theme to
Installation & Setup make it accept calls from your AShop to register members. Inside the functions.php file for your Wordpress theme, insert a code like this:
/* AShop remote registration payment */
add_action("init", "make_registrationlink");
function make_registrationlink(){
$secretkey = "myownsecrectkey";
if($_GET["make_registrationlink"]){
$subscr_id = $_GET["orderid"];
$custom = $_SERVER["HTTP_HOST"];
$item_number = $_GET["item"];
$reg = $_GET["reg"];
$checkreg = md5($subscr_id.$item_number.$secretkey);
if ($checkreg == $reg) {
$link = ws_plugin__s2member_register_link_gen ($subscr_id, $custom,
$item_number, TRUE);
echo "<!-- StartAShopS2Member-$link-EndAShopS2Member -->";
exit;
}
}
}
Make sure to change the $secretkey variable to your own personal key for this site.
Prepare your AShop
1. Add a fulfilment option on the page Configuration->Fulfilment in your AShop admin panel. Use the
S2Member Registration method.
2. Set the URL field to the URL of your s2member site.
3. Set the Password field to the value of your $secretkey, which you previously added to the functions.
php page of your s2member site.
4. Create or locate a product on the Edit Catalog page and click Attributes.
5. Add an attribute for the membership level, for example labeled "Level". If you want this to be customer
selectable so your customers can buy different membership levels through the same product, add 4
alternatives, otherwise add just 1.
6. Set the attribute alternative(s) to the s2member membership level(s), for example "1" or "4".
7. Click the Fulfilment button for the product you just prepared and select the s2member fulfilment option
you created previously.
8. Set the name of the level attribute to: level
Note: The name of the attribute on the fulfilment configuration page is case sensitive and must be
exactly "level", not "Level" or "LEVEL" or "membershiplevel".
Now your customers will be given a temporary link that allows them to sign up at your s2member site
when they buy
the product. It will be included in the receipt that is emailed to the customer after successful payment.
By setting up
multiple fulfilment options and/or products you can sell different membership levels or even memberships
at different s2member sites.
<?php
// S2Member Registration...
$fulfilmentname = "S2Member Registration";
$ff_parameters['fulfilemail'] = "false";
$ff_parameters['fulfilmessage'] = "false";
$ff_parameters['userid'] = "false";
$ff_parameters['password'] = "true";
$ff_parameters['url'] = "true";
$ff_parameters['parameternames'] = "false";
$ff_parameters['extrafields'] = "false";
$ff_parameters['returnresult'] = "true";
$ff_parameters['discount'] = "false";
$ff_parameters['ecardimage'] = "false";
$ff_parameters['ecardfont'] = "false";
$ff_parameters['ecardtextcolor'] = "false";
$ff_parameters['ecardtexttop'] = "false";
$ff_parameters['ecardtextleft'] = "false";
$ff_parameters['ecardtextright'] = "false";
$ff_prodparameters['productid'] = "false";
$ff_prodparameters['productidlist'] = "false";
$ff_prodparameters['labelnumber'] = "false";
$ff_prodparameters['packagenumber'] = "false";
$ff_prodparameters['parameternames'] = "true";
if ($dofulfilment) {
$returnmessages["$fulfilmentoptionid"] = "";
if($productsinfo) foreach($productsinfo as $productnumber => $productinfo) {
$quantity = $productinfo["quantity"];
$paramquerystring = $productinfo["ffparamquerystring"];
$paramarray = explode("&",$paramquerystring);
if (!empty($paramarray) && is_array($paramarray)) foreach ($paramarray as $thisparameter) {
$thisparameterarray = explode("=",$thisparameter);
if ($thisparameterarray[0] == "level") $s2member_level = $thisparameterarray[1];
}
$s2member_reg = md5($parsed_invoice.$s2member_level.$fulfilmentpassword);
$s2member_data = "make_registrationlink=1&orderid=$parsed_invoice&item=$s2member_level®=$s2member_reg";
if (!empty($parsed_invoice) && !empty($s2member_level) && !empty($fulfilmenturl) && !empty($fulfilmentpassword)) {
for ($item = 0; $item < $quantity; $item++) {
$ch = curl_init ($fulfilmenturl);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $s2member_data);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec ($ch);
// Process return value...
$res = explode("<!-- StartAShopS2Member-",$res);
$res = explode("-EndAShopS2Member -->",$res[1]);
$registrationurl = $res[0];
// Check the result...
if (!empty($registrationurl) && (strstr($registrationurl,"http://tinyurl.com") || strstr($registrationurl,$s2memberurl))) {
// Return message with URL...
if ($receiptformat == "html") $returnmessages["$fulfilmentoptionid"] .= "<tr><td colspan=\"2\"><table width=\"100%\" cellpadding=\"5\"><tr><td bgcolor=\"#ffffff\" align=\"left\"><font face=\"Arial, Helvetica, sans-serif\" size=\"2\"><a href=\"$registrationurl\">Click here</a> to activate your membership at: $fulfilmenturl</font></td></tr></table></td></tr>";
else $returnmessages["$fulfilmentoptionid"] .= "
Go to: $registrationurl to activate your membership.
";
} else $returnmessages["$fulfilmentoptionid"] .= "The membership signup was unsuccessful! Call the shop owner to get your membership activated manually.";
}
} else $returnmessages["$fulfilmentoptionid"] .= "The membership signup was unsuccessful! Call the shop owner to get your membership activated manually.";
}
}
?>
Statistics: Posted by gregtampa — April 21st, 2011, 1:02 pm