The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Change All Accounts From Retro to Paper Lantern?

Discussion in 'User Experience' started by taquion, Sep 2, 2016.

Tags:
  1. taquion

    taquion Registered

    Joined:
    Sep 2, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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.
     
  2. domeneas

    domeneas Active Member

    Joined:
    Sep 20, 2013
    Messages:
    27
    Likes Received:
    1
    Trophy Points:
    3
    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
     
    #4 domeneas, Sep 20, 2016
    Last edited: Sep 20, 2016
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,762
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  4. domeneas

    domeneas Active Member

    Joined:
    Sep 20, 2013
    Messages:
    27
    Likes Received:
    1
    Trophy Points:
    3
    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?
     
    #6 domeneas, Sep 21, 2016
    Last edited: Sep 21, 2016
    cPanelMichael likes this.
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,762
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page