RPS Posted October 8, 2009 Share Posted October 8, 2009 If you're using the API to add a new client to WHMCS, and would like to set the Group ID of that new client, here's how: Grab the new client id from the result of creating a new client. This should be in the $results array, under clientid: $set_groupid_result = mysql_query("UPDATE tblclients SET groupid='1' WHERE id='".$results['clientid']."' LIMIT 1"); You will need to login to the admin area to find out what the correct groupid is. In the above case, the groupid is 1. You will also need to create a database connection in order to execute the MySQL command. Here's the full script, given the clientid. // include the connection details include('/home/user/public_html/whmcs/configuration.php'); // connect to the database $connectMe = @mysql_connect ($db_host, $db_username, $db_password); // verify the connection took place if(!(@mysql_select_db ($db_name))) { exit ('<p><b>Critical Error</b></p><p>Unable to connect to database</p>'); } // set the correct groupid for the new user $set_groupid_result = mysql_query("UPDATE tblclients SET groupid='1' WHERE id='".$results['clientid']."' LIMIT 1"); 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.