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.

Accounts::Create post hook homedir?

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

  1. ehask71

    ehask71 Active Member

    Joined:
    Jul 13, 2007
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    6
    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
     
  2. charsleysa

    charsleysa Active Member

    Joined:
    Jul 18, 2011
    Messages:
    41
    Likes Received:
    0
    Trophy Points:
    6
    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.
     
  3. ehask71

    ehask71 Active Member

    Joined:
    Jul 13, 2007
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    6
    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
     
  4. 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
  5. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    18
    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);
    
     
Loading...

Share This Page