Change All Accounts From Retro to Paper Lantern?

taquion

Registered
Sep 2, 2016
1
0
1
Puebla
cPanel Access Level
Root Administrator
Hello

There is a way to massively change all the accounts with Retro Paper Lantern style in order to use the Basic Paper Lantern style?

I've tried to change only the symbolic link on

/home/user/var/cpanel/styled/

from: /usr/local/cpanel/base/frontend/paper_lantern/styled/retro/ to /usr/local/cpanel/base/frontend/paper_lantern/styled/basic/

But the loaded style is a mixed "retro style" with "basic style" colors.

Thanks in advance.
 

domeneas

Well-Known Member
Sep 20, 2013
48
13
58
cPanel Access Level
Root Administrator
The solution to that thread, running "rm -rf /home/*/var/cpanel/styled" gives the same effect as described in the initial post here and as following the command line documentation here:
Guide to cPanel Interface Customization - Apply Styles - Software Development Kit - cPanel Documentation

PS: Actually the documentation here is wrong too it seems, to create a symlink to the directory of the theme you cannot specify styles.css in the link, you need to leave it open like this:
ln -s /var/cpanel/customizations/styled/mystyle/ /home/username/var/cpanel/styled/current_style


If I manually edit the symlink, it is the same effect as above, I get a mixed RETRO theme with BASIC colors. I have added a screenshot. I also have disabled the option to change styles for users, but only when I enable it and change styles from within cpanel am I able to successfully change styles so it looks correct. Nothing else worls.

styles.jpg
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,903
2,237
463
Hello,

You may find the following UAPI function more helpful for this action:

UAPI Functions - Styles::update - Software Development Kit - cPanel Documentation

EX:

Code:
uapi --user=username Styles update type=default name=basic
This will set the default style for a cPanel account, and you could setup a loop that runs the command for all users on the system.

Note that internal case DOC-6231 is open to update Tutorial - Create a Custom cPanel Style - Software Development Kit - cPanel Documentation with improved instructions.

Thank you.
 

domeneas

Well-Known Member
Sep 20, 2013
48
13
58
cPanel Access Level
Root Administrator
Hello, and thanks for your reply. Unfortunately I get an error doing that. I have of course replaced "username" with a real customer. We have no re sellers in our system.

apiversion: 3
func: set_default
module: Styles
result:
data: ~
errors:
- username should be a reseller to set default style
messages: ~
metadata: {}

EDIT: Solved. I poked around that UAPI call and found that "update" and not "set_default" works. The server is running through 1000+ accounts now. Thank you very much., 4 more to go.

Here is my step by step, the account list is a bit clunky.
1- Run: whmapi1 listaccts searchtype=user > accounts.txt
2 - Run: grep -i 'user:' accounts.txt > account_usernames.txt
3 - Search and replace the blank spaces & user: to nothing, leaving only usernames.
4- Run the code:
Code:
#! /bin/sh
while IFS= read -r uname
do
    uapi --user=$uname Styles update type=default name=basic
done < "account_usernames.txt"
This will fix any themes stuck in RETRO and skip any already on BASIC. The only drawback is for any accounts that are "broken" like in my screenshot above that have been switched to BASIC earlier through a broken method are not fixed. They still need to manually be set to BASIC or reverted back to RETRO then have the script run again.

Now if only I knew the Location of resetpass-email.tmpl?
 
Last edited:
  • Like
Reactions: cPanelMichael

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,903
2,237
463