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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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 Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,182
    Likes Received:
    1,756
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page