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™
Pro API For Remote Operations ( some scripting required )
With s2Member Pro installed, you have access to the s2Member Pro API For Remote Operations. This is made available for developers that wish to create User/Member accounts dynamically through custom scripts of their own. s2Member's Remote Operations API requires a secret API Key in order to POST authenticated requests to your installation of s2Member. Here is the API Key for this installation domain:
...
Experimental: The Remote Operations API is currently in an experimental state. The only Operation that is currently possible, is the create_user Operation, which is shown in the code sample below. In a future release of s2Member Pro, we will add further documentation and some additional Remote Operations to this API. Thanks for your patience.
<?php
$nextYear = time() + (60 * 60 * 24 * 365);
$whm_user = "don'tpeekhere";
$whm_pass = "don'tpeekhere";
$whm_host = $_SERVER['HTTP_HOST'];
global $wpdb;
$table = $wpdb->prefix . "Orders";
$cid = $_REQUEST["cid"];
$result = $wpdb->get_results( "SELECT user_name, user_email, user_domain, user_plan, gateway FROM {$table} WHERE cust_id = {$cid} LIMIT 1;" );
$op["op"] = "create_user";
$op["api_key"] = "55676d6e246a4ae18037c40087d67e86";
$op["data"] = array (
"user_login" => "{$result->user_email}",
"user_email" => "{$result->user_email}",
"user_pass" => "{$result->user_pass}",
"s2member_level" => "1",
"s2member_ccaps" => "",
"s2member_registration_ip" => "",
"s2member_subscr_gateway" => "{$result->gateway}",
"s2member_subscr_id" => "",
"s2member_custom" => "93hosting.com",
"s2member_auto_eot_time" => "$nextYear", /* Optional. Can be any value that PHP's ``strtotime()`` function will understand ( i.e. YYYY-MM-DD ). */
"opt_in" => "1", /* Optional. A non-zero value tells s2Member to attempt to process List Servers that you've configured in the Dashboard area. */
"custom_fields" => array ("cust_id" => $cid), /* Optional. An array of Custom Registration Field ID's, with associative values. */
"s2member_notes" => "Administrative notation. Created this User via API call.",
"notification" => "1", /* Optional. A non-zero value tells s2Member to email the new User/Member their Username/Password. */
/* The "notification" parameter also tells s2Member to notify the site Administrator about this new account. */
);
if (!empty($user_name)) {
$script = "http://{$whm_user}:{$whm_pass}@{$whm_host}:2086/scripts/wwwacct";
$params = "?plan={$result->user_plan}&domain={$result->user_domain}&username={$result->user_email}&password={$result->user_email}&contactemail={$result->user_email}";
$result1 = file_get_contents($script.$params);
}
$result2 = trim (file_get_contents ("http://93hosting.com/?s2member_pro_remote_op=1", false, stream_context_create (array ("http" => array ("method" => "POST", "header" => "Content-type: application/x-www-form-urlencoded", "content" => "s2member_pro_remote_op=" . urlencode (serialize ($op)))))));
if (!empty ($result2) && !preg_match ("/^Error\:/i", $result2) && is_array ($user = @unserialize ($result2)) && $result1 == !preg_match ("/^Error\:/i", $result1))
{ header("Location: http://93hosting.com/welcome/"); }
else
echo "API error: " . $result1 . "\n\n" . $result2;
?>
Users browsing this forum: Google [Bot] and 1 guest