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.

API - Create new account with skeleton

Discussion in 'cPanel Developers' started by RingoStarr, Apr 14, 2010.

  1. RingoStarr

    RingoStarr Registered

    Joined:
    Jul 16, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    is there a simple way to create an account (via the API), and once it's created, to place in the public_html folder some files and dirs (but only for specifics accounts) ?

    Here's what I've done :
    - I gave the reseller privileges to the account with wich I want to create the others,
    - I've put the files and folders I want into the main account homedir.

    If I create accounts via WHM with the reseller account, the accounts created have the skeleton files and dirs, but if I do it via the API, it doesn't work this way.

    I've also tried the fileman / extract function but it works only in the creator account homedir.

    A bit of Googling told me about the postwwwacct script hook, but I don't want my skeleton for all the accounts created.

    Any ideas about this ?

    Thank you !
     
  2. darrenl

    darrenl Member

    Joined:
    Apr 13, 2010
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    Hello, I am wondering this too. Would this be possible to do cPanel?
     
  3. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi guys,

    Create a postwwwacct script that performs the mv/skeleton extract based on the owner of the created account. If it's not your special reseller, then skip the extract. Script Hook scripts are language agnostic, so you could script in whatever language you wish: Perl, PHP, bash, etc.

    If you take a look at the postwwwacct arguments, cPanel/WHM Script Hooks, you'll see that one of the hash keys is 'owner'. Bingo!

    Hope that helps,
    -Dave
     
  4. RingoStarr

    RingoStarr Registered

    Joined:
    Jul 16, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Thank you Dave for you answer.

    The postwwwacct script seems to be the good way.
    One question : is there a way to post a specific parameter to it ?

    In my custom-made account creation form, I ask for the site name (different from URL and user name), and this I need to set up a configuration file in PHP, so I need to post this value to the script after account creation...
     
  5. leefrom

    leefrom Active Member

    Joined:
    May 27, 2008
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    6
    Hi Ringo,

    I don't believe you can do that per se, but you could try creating a datastore before hand in your PHP that your postwwwacct script could go pick up.
     
Loading...

Share This Page