CWP account hooks NOT WORK!!

Started by comokoko, November 11, 2019, 03:44:11 PM

Previous topic - Next topic

comokoko

I try contact before one more times support but I can't get any answer....

From wiki:
https://wiki.centos-webpanel.com/action-hooks

QuoteAccount Hooks
account_new (VALUES: username,domain)
/usr/local/cwpsrv/htdocs/resources/admin/hooks/account/account_new.php ......

I create directorys and account_new.php file with this content:

<?php
$arr 
= get_defined_vars();
print_r($arr);
function 
account_new($u){
    echo 
"Hello World ....";
}
?>


when new account creation newer print "Hello World ...."  because CWP newer run "account_new" function in this PHP file.

cyberspace

Sorry for the necropost :)

Not sure if it cwp allows to print some output from the hooks. However the hooks described here:
https://wiki.centos-webpanel.com/action-hooks
work for me.

Here is a simple example (just a bit modified example provided by docs):

cat /usr/local/cwpsrv/htdocs/resources/admin/hooks/account/account_new.php



<?php
function account_new($array){
        
$fp = fopen('/tmp/account_new.txt', 'w');
        
fwrite($fp, print_r($array, TRUE));
        
fclose($fp);
}
?>




then create some account and review the file /tmp/account_new.txt.

mah1973

Quote from: cyberspace on March 19, 2021, 05:08:18 PM
Sorry for the necropost :)

Not sure if it cwp allows to print some output from the hooks. However the hooks described here:
https://wiki.centos-webpanel.com/action-hooks
work for me.

Here is a simple example (just a bit modified example provided by docs):

cat /usr/local/cwpsrv/htdocs/resources/admin/hooks/account/account_new.php



<?php
function account_new($array){
        
$fp = fopen('/tmp/account_new.txt', 'w');
        
fwrite($fp, print_r($array, TRUE));
        
fclose($fp);
}
?>




then create some account and review the file /tmp/account_new.txt.

The new account hook works but when you try account unsuspend it doesn't work!