Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Accounts::Create post hook homedir?

Discussion in 'cPanel Developers' started by ehask71, Nov 28, 2012.

  1. ehask71

    ehask71 Well-Known Member

    Joined:
    Jul 13, 2007
    Messages:
    54
    Likes Received:
    4
    Trophy Points:
    58
    Location:
    Tampa, Florida, United States
    cPanel Access Level:
    Root Administrator
    create account post hook doesnt return homedir??

    Does anyone know how to figure out where the acct home dir is for the created account?? The data array sent to the hook in post doesnt include the homedir location. I just ran into a weird situation with my WP installer script the hook listens for acct create and if the plan is a WordPress plan it does a full install of Wordpress.

    The problem is my server all of a sudden decided to switch to /home2 (im still investigating why this happened) but it broke my custom autoinstaller. I believe postwwwacct used to pass homedir but I dont use that anymore I migrated my code to use hooks.

    Is this a bug or do I have to do tests to find the homedir????

    Thx,
    Eric Haskins
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. charsleysa

    charsleysa Active Member

    Joined:
    Jul 18, 2011
    Messages:
    41
    Likes Received:
    0
    Trophy Points:
    56
    Location:
    Palmerston North, New Zealand
    cPanel Access Level:
    Root Administrator
    According to the Standardized Hooks documentation, the directory of the user files isn't available, but there are other ways of retrieving it such as reading the user data file and finding the home directory parameter.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. ehask71

    ehask71 Well-Known Member

    Joined:
    Jul 13, 2007
    Messages:
    54
    Likes Received:
    4
    Trophy Points:
    58
    Location:
    Tampa, Florida, United States
    cPanel Access Level:
    Root Administrator
    Just seems like a piece of pertinant info that create acct is aware of and should be passed in a hook. Its sent in the new acct email and postwwwacct

    I put in a work around last night doing exactly what you suggest here just feels like a dirty hack

    CPanel can you reevaluate your return values in Create Acct homedir is a dynamic value and really should be returned
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    3
    Trophy Points:
    68
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    68
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator

    use this code to get the user's homedir:

    Code:
    BEGIN { unshift( @INC, '/usr/local/cpanel' ); }
    use Cpanel::PwCache ();
    my $homedir = Cpanel::PwCache::gethomedir($user);
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice