WHMCS 动作挂钩

WHMCS Action Hook

这是我的 WHMCS 挂钩:

<?php
function hook_api_suspend($vars) {

$table = "apis_user_profiles";
$update = array("status"=>"0");
$where = array("user_id"=>"342329");
update_query($table,$update,$where);
}

add_hook('AfterModuleSuspend', 1, 'hook_api_suspend');

?>

这是我特别遇到问题的行:

$where = array("user_id"=>"342329");

当我暂停一个帐户时,它确实会为 user_id 为 342329 的用户正确更新状态。但是,我怎样才能让它使用实际用户帐户的 user_id被暂停?我已经尝试在那里输入一些变量,但 none 似乎有效...?

根据 hook documentation,用户 ID 在 $vars[[=​​14=]]['userid'] 中传递。 $where 数组变为:

$where = array("user_id" => $vars['params']['userid']);