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.

Retrieve User NVData from Standardized Hook

Discussion in 'cPanel Developers' started by Craig Marchant, Aug 8, 2017.

  1. Craig Marchant

    Craig Marchant Registered

    Joined:
    Dec 22, 2015
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Melbourne, VIC, Australia
    cPanel Access Level:
    DataCenter Provider
    Hi,

    I have a need to retrieve a users nvdata entries when operating a number of hooks, is there a way I can do that?

    Once such hook is Whostmgr::Accounts::Modify

    Using perl modules as well, fyi.

    I thought this code would be close to what I need, except I assume need to specify username as well?

    my $filename = 'test123';
    my $nvData = Cpanel::API::execute( 'NVData', 'get', { 'names' => $filename } );

    Many thanks in advance.

    Craig
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,493
    Likes Received:
    31
    Trophy Points:
    308
    cPanel Access Level:
    Root Administrator
    Hi,

    Usually, you need to call Cpanel::initcp before calling any API calls in the Cpanel or Cpanel::API name spaces. Something like:

    Code:
    use Cpanel;
    
    my $cpanel = Cpanel->new();
    $cpanel->initcp( "cpanel_user_name");
     
Loading...

Share This Page