i need to update my website database on a particular invoice payment and addon activation
for which i have made three action hooks
one on invoice creation for data entry ,
second on addon activation
third on invoice payment
the first one is working properly and i be able to successfully enter data in my database on invoice creation but the other two are not working.
my hooks.php code---
this is my first function which is working fine.
function update_db($vars)
{
//when any invoice is created----
$invoiceid=$vars['invoiceid'];
$url = 'http://www.XXX.com/user/add_order_todb';
$date=date('Y-m-d');
$postfields = array( 'orderid' =>$invoiceid, 'date' => $date);
$options = array( 'CURLOPT_TIMEOUT' => '1000');
$response = curlCall($url,$postfields,$options);
}
the below two functions are not working .
function update_status($vars)
{
//when any invoice is paid---
$invoiceid=$vars['invoiceid'];
$url = 'http://www.XXX.com/user/paid_invoice_upgrade';
$postfields = array( 'invoiceid' =>$invoiceid);
$options = array( 'CURLOPT_TIMEOUT' => '1000');
$response = curlCall($url,$postfields,$options);
}
function hook_add_storage($vars) {
//when any addo on is activated----
$addonid=$vars['id'];
$userid=$vars['userid'];
$serviceid=$vars['serviceid'];
$predefined_addonid=$vars['addonid'];
$url = 'http://www.XXX.com/user/add_client_storage';
$postfields=array('id'=>$addonid,'userid'=>$userid ,'serviceid'=>$serviceid,'addonid'=>$predefined_ad donid);
$options = array( 'CURLOPT_TIMEOUT' => '500');
$response = curlCall($url,$postfields,$options);
}
add_hook("InvoiceCreated",1,"update_db");
add_hook("AddonActivation",1,"hook_add_storage");
add_hook("InvoicePaid",1,"update_status");
i dont even know if it is being called or not i have tried using echo and print option and also tried redirection through header() function but none of them worked isn't there any way to check if hooks function is being called or not.
one of the curl url function i have used called by hook_add_storage() hook function
inside user controller in my site--
public function add_client_storage()
{
$addonid=$_REQUEST['id'];
$clientid=$_REQUEST['userid'];
$serviceid=$_REQUEST['serviceid'];
$predefined_addonid=$_REQUEST['addonid'];
$res=$this->mdl_user->update_storage_client($clientid);
}
when i run this controller funtion using default values it works fine .there must be some problem with the hooks function.please help me.
for which i have made three action hooks
one on invoice creation for data entry ,
second on addon activation
third on invoice payment
the first one is working properly and i be able to successfully enter data in my database on invoice creation but the other two are not working.
my hooks.php code---
this is my first function which is working fine.
function update_db($vars)
{
//when any invoice is created----
$invoiceid=$vars['invoiceid'];
$url = 'http://www.XXX.com/user/add_order_todb';
$date=date('Y-m-d');
$postfields = array( 'orderid' =>$invoiceid, 'date' => $date);
$options = array( 'CURLOPT_TIMEOUT' => '1000');
$response = curlCall($url,$postfields,$options);
}
the below two functions are not working .
function update_status($vars)
{
//when any invoice is paid---
$invoiceid=$vars['invoiceid'];
$url = 'http://www.XXX.com/user/paid_invoice_upgrade';
$postfields = array( 'invoiceid' =>$invoiceid);
$options = array( 'CURLOPT_TIMEOUT' => '1000');
$response = curlCall($url,$postfields,$options);
}
function hook_add_storage($vars) {
//when any addo on is activated----
$addonid=$vars['id'];
$userid=$vars['userid'];
$serviceid=$vars['serviceid'];
$predefined_addonid=$vars['addonid'];
$url = 'http://www.XXX.com/user/add_client_storage';
$postfields=array('id'=>$addonid,'userid'=>$userid ,'serviceid'=>$serviceid,'addonid'=>$predefined_ad donid);
$options = array( 'CURLOPT_TIMEOUT' => '500');
$response = curlCall($url,$postfields,$options);
}
add_hook("InvoiceCreated",1,"update_db");
add_hook("AddonActivation",1,"hook_add_storage");
add_hook("InvoicePaid",1,"update_status");
i dont even know if it is being called or not i have tried using echo and print option and also tried redirection through header() function but none of them worked isn't there any way to check if hooks function is being called or not.
one of the curl url function i have used called by hook_add_storage() hook function
inside user controller in my site--
public function add_client_storage()
{
$addonid=$_REQUEST['id'];
$clientid=$_REQUEST['userid'];
$serviceid=$_REQUEST['serviceid'];
$predefined_addonid=$_REQUEST['addonid'];
$res=$this->mdl_user->update_storage_client($clientid);
}
when i run this controller funtion using default values it works fine .there must be some problem with the hooks function.please help me.