Php 在Ninja Forms Webhooks扩展中,是否可以在不编辑插件';s process()函数?
我试图在将表单的提交变量提交到操作URL之前对其进行编辑。我可以通过改变来完成我想要的Php 在Ninja Forms Webhooks扩展中,是否可以在不编辑插件';s process()函数?,php,wordpress,Php,Wordpress,我试图在将表单的提交变量提交到操作URL之前对其进行编辑。我可以通过改变来完成我想要的 $args[ $vars['key'] ] = $value; 在action-webhooks.php中process()函数的初始foreach循环中 if (is_array ($value)) { $args[ $vars['key'] ] = implode(';', $value); } else { $args[ $vars['key'] ] = $value; } 这显然是
$args[ $vars['key'] ] = $value;
在action-webhooks.php中process()函数的初始foreach循环中
if (is_array ($value)) {
$args[ $vars['key'] ] = implode(';', $value);
}
else {
$args[ $vars['key'] ] = $value;
}
这显然是一个糟糕的解决方案,因为如果插件更新,此代码将被覆盖。是否有一个操作或过滤器可以用来从我自己的代码中实现这一点?谢谢。据我所知,使用忍者表单处理方法,您可以在表单完全处理之前设置变量
global $ninja_forms_processing;
//get the form id
$form_id = $ninja_forms_processing->get_form_ID();
//The id of the form you want to check
$form_to_check = 5;
if($form_id == 5)
{
//What the user entered
$user_value = $ninja_forms_processing->get_field_value( 3 );
if(is_array($user_value))
{
//set the value to what it you want it to be
$new_value = implode(';', $user_value);
$ninja_forms_processing->update_field_value( 3, $new_value );
}
}