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!

Hook is not activated when creating an account

Discussion in 'cPanel Developers' started by Mayc, Mar 7, 2018.

Tags:
  1. Mayc

    Mayc Member

    Joined:
    Oct 11, 2017
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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?
    [​IMG]
    Boceto.png
    thanks
     
    #1 Mayc, Mar 7, 2018
    Last edited: Mar 7, 2018
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,749
    Likes Received:
    1,885
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    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