How to change cpanel accts and packages to x3 after uninstalling rvskin?
Hello,
We are going to uninstall the "RVSKIN" cpanel theme from our servers. How can we change all accounts and WHM Packages that are using one of the rvskin themes to "x3"?
The rvskin includes a bunch of different themes that customers might be using:
rvskin
rvneo
rvdiy
rvgreen
rvblue
rvpink
rvlight
etc...
(They all start with the "rv" prefix...)
We want to modify all the accounts and packages that are using any of the "rvskin" themes to "x3".
Thanks!
-
To clarify, a different way to accomplish what we want is to switch all WHM package themes and customer account themes that are not "paper_lantern" to "x3". So any cpanel account or WHM package that is set to "paper_lantern" should be left as-is. Anything else should be switched to "x3". Thanks! 0 -
Hello :) You can simply edit your packages via: "WHM Home " Packages " Edit a Package" Change the theme configured for the package, and all accounts using that package will have their theme updated automatically. Thank you. 0 -
We have several hundred customer accounts, dozens of resellers, and about 80 different packages. Updating every package one-by-one isn't realistic. Also, your solution doesn't consider any cpanel accounts not associated with a package. It also doesn't consider the scenario where reseller has modified a cpanel account in some way, yet chosen to keep it linked to the package without modifying the package settings. By updating the reseller's package, we would cause any custom modifications they've made to that account to be lost. (Which would result in a reseller customer who is mad at us for screwing around with his accounts...) 0 -
Hello :) Yes, that's all important information to consider. You may want to manually modify the files in: /var/cpanel/users/ /var/cpanel/packages/ Change the "RS=" value for the cPanel user files, and the "CPMOD=" value in the packages using a custom bash command (e.g. replace). After modifying the cPanel user files, then run: /scripts/updateuserdomains
Thank you.0 -
Is there any way to automate this? As I mentioned, we have many hundreds of cpanel accounts and dozens of packages on our servers. Manually editing individual files is not realistic. (Especially since we have multiple servers...) [COLOR="silver">- - - Updated - - - In other words, surely the cpanel devs must have a tool or code to do this already? I can't believe I'm the first/only cpanel customer to ask how to do this over the years... 0 -
[quote="electric, post: 1643202">Is there any way to automate this? As I mentioned, we have many hundreds of cpanel accounts and dozens of packages on our servers. Manually editing individual files is not realistic. (Especially since we have multiple servers...).
I suggested using a custom bash command such as "replace" to complete this for all accounts with one or two commands. In a thread you replied to last week, a user suggests a custom script: Submit A Feature Request Thank you.0 -
For anyone who is reading this, here is some simple PHP code the uses the cpanel/WHM api to change the theme for all accounts that are NOT using "x3" or "paper_lantern":[PHP] as $key=>$value) { if ( ($value['theme"> != "x3") && ($value['theme"> != "paper_lantern") ) { echo $value['user"> ." : " . $value['theme"> . " : "; // Change theme to x3. $result2 = doCpanelQuery("https://".$whm_hostname.":2087/json-api/modifyacct?user=".$value['user">."&RS=x3"); $result2 = json_decode($result2, true); echo $result2['result">[0]['statusmsg"> . "
"; } } function doCpanelQuery($query) { global $whm_username, $whm_password; $curl = curl_init(); # Create Curl Object curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0); # Allow self-signed certs curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0); # Allow certs that do not match the hostname curl_setopt($curl, CURLOPT_HEADER,0); # Do not include header in output curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); # Return contents of transfer on curl_exec $header[0] = "Authorization: Basic " . base64_encode($whm_username.":".$whm_password) . "\n\r"; curl_setopt($curl, CURLOPT_HTTPHEADER, $header); # set the username and password curl_setopt($curl, CURLOPT_URL, $query); # execute the query $result = curl_exec($curl); if ($result == false) { die("curl_exec threw error \"" . curl_error($curl) . "\" for $query");} curl_close($curl); return $result; } ?>[/PHP]0 -
And here is the PHP code for updating all WHM packages on the server that are NOT "x3" or "paper_lantern": [PHP] as $key=>$value) { if ( ($value['CPMOD"> != "x3") && ($value['theme"> != "paper_lantern") ) { echo $value['name"> ." : " . $value['CPMOD"> . " : "; // Change theme to x3. $result2 = doCpanelQuery("https://".$whm_hostname.":2087/json-api/editpkg?name=".$value['name">."&cpmod=x3"); $result2 = json_decode($result2, true); echo $result2['result">[0]['statusmsg"> . "
"; } } function doCpanelQuery($query) { global $whm_username, $whm_password; $curl = curl_init(); # Create Curl Object curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0); # Allow self-signed certs curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0); # Allow certs that do not match the hostname curl_setopt($curl, CURLOPT_HEADER,0); # Do not include header in output curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); # Return contents of transfer on curl_exec $header[0] = "Authorization: Basic " . base64_encode($whm_username.":".$whm_password) . "\n\r"; curl_setopt($curl, CURLOPT_HTTPHEADER, $header); # set the username and password curl_setopt($curl, CURLOPT_URL, $query); # execute the query $result = curl_exec($curl); if ($result == false) { die("curl_exec threw error \"" . curl_error($curl) . "\" for $query");} curl_close($curl); return $result; } ?>[/PHP] Please note -- using the API method to update all WHM packages on your server will trigger an "update" to all accounts that are using that package. So if you have customized a cpanel account, but kept is assigned to a package that is updated, the cpanel account will be "synced" to the package your customization will be lost.0
Please sign in to leave a comment.
Comments
8 comments