Retrieve User NVData from Standardized Hook

Craig Marchant

Registered
Dec 22, 2015
3
0
1
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
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
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");