Enabling S3 users in WHMCS
You can enable a previously disabled user with the ostor-users service and parameter emailAddress specifying the user email address. WHMCS enables read and write access to S3 cluster for user when you click Enable User. Create a file S3_enableUser.php with the following contents:
<?php
// Load configuration and libraries.
require('../../includes/staas_scripts/S3_getClient.php');
require('../../includes/staas_scripts/S3_getConfig.php');
require('../../includes/staas_scripts/S3_requestCurl.php');
require('../../init.php');
// Enable user.
function S3_enableUser($userid) {
// Load configuration.
$s3_config = s3_getConfig();
// Get whmcs user email.
$s3_whmcs = S3_getClient($userid, $s3_config['whmcs_username']);
// Enable user.
$s3_client = S3_requestCurl(
$s3_config['s3_key'],
$s3_config['s3_secret'],
$s3_config['s3_gateway'],
"/?ostor-users&emailAddress=" . $s3_whmcs['email'] . "&enable",
"POST"
);
// Redirect back.
header('Location: ' . $_SERVER['HTTP_REFERER']);
}
// Call function.
S3_enableUser($_GET['userid']);
?>