"342329"); update_query($table,$update,$where); } -6ren">
gpt4 book ai didi

php - WHMCS Action Hook

转载 作者:行者123 更新时间:2023-11-30 22:50:10 36 4
gpt4 key购买 nike

这是我的 WHMCS Hook :

<?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 ?我已经尝试在那里输入一些变量,但似乎没有一个有效...?

最佳答案

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

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

关于php - WHMCS Action Hook ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28391956/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com