s2member integration:

1. Modifications on the WordPress site:

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.

2. Modifications on the AShop site:

a. Edit the automation/s2member.php script and make sure the $ashoppath is set to the correct path to your AShop.
   Change the $password variable to a personal password, to prevent unauthorized use of the s2member.php script.
   Upload the modified s2member.php script to your AShop.

b. Add a fulfilment option on the page Configuration->Fulfilment in your AShop admin panel. Use the automation method
   and set the URL field to: http://www.yourdomain.com/ashop/automation/s2member.php
   modified to match the URL to your own AShop.

   Check the option "Include returned data in receipt".

   Set the "Other fields + values" box to: password=myownpassword
   Where "myownpassword" should be replaced with the password you entered in the s2member.php script at step 2a.

   Leave the rest of the fields unchanged.

c. Add three parameters to your product in the AShop admin panel. They can be called anything you like, but should all have
   just one alternative, unless you want to let the customer select the membership level through a drop down box, in which case
   you should add 4 alternatives to one of the attributes.

   One attribute will be the membership level, which should have one or more alternatives set to 1,2,3 or 4, which corresponds
   to the membership levels at your s2member site.

   One attribute should have an alternative that is set to the URL to your s2member site.

   The remaining attribute should be set to the secret key you entered in your functions.php on the s2member site.
   
   Once the attributes are setup, click "Fulfilment" on the product, select the fulfilment option you created in step 2b
   and then map the attributes to the following names:

   level
   s2memberurl
   secretkey

Done! 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 products you can sell different membership levels or even memberships at different s2member sites.