Hook is not activated when creating an account

Mayc

Member
Oct 11, 2017
11
0
1
Spain
cPanel Access Level
Root Administrator
Boceto.png Hello I have created the following test Hook based on the examples.
Code:
#!/usr/bin/perl

# Package this module.
package MyHook;

# Return errors if Perl experiences problems.
use strict;
use warnings;

# Use cPanel's error logging module.
use Cpanel::Logger;

# Instantiate the cPanel logging object.
my $logger = Cpanel::Logger->new();

# Embed hook attributes alongside the action code.
sub describe {
    my $hooks = [
        {
            'category' => 'Whostmgr',
            'event'    => 'Accounts::Create',
            'stage'    => 'post',
            'hook'     => 'MyHook::crearcron',
            'exectype' => 'module',
        }
    ];
    return $hooks;
}

sub crearcron {
    $logger->info("***** SIIIIII *****");
 
}
I have registered it, it gives me correct registration and appears in the list of registered hooks. But it doesn't run when I create an account. The function is now simplified just to see what really jumps. But he doesn't jump. what can happen?

Boceto.png
thanks
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello,

You can configure the "Standardized Hooks - Debug Mode" option under the "Development" tab in "WHM >> Tweak Settings" to:

Debug mode is on. The system displays information about every stage for every hookable event, even if no hooks exist for that stage.

Then, monitor /usr/local/cpanel/logs/error_log when creating a new account to verify what happens during the account creation process.

Thank you.