嗨,我呼应了gform的一个短代码,但我需要检查在php中以编程方式调用函数的确认消息是什么,如果成功,则调用另一个函数。有可能吗?
发布于 2022-06-15 14:45:24
在处理提交时,要使用的确认消息存储在GFFormDisplay::$submission属性中,以便在页面呈现中处理表单短代码或块时可以检索该消息。您可以这样访问它:
$confirmation = rgars( GFFormDisplay::$submission, $form_id . '/confirmation_message' );另外,您也可以使用确认筛选器覆盖在处理提交时使用的确认,然后将其添加到GFFormDisplay::$submission属性。
add_filter( 'gform_confirmation', function ( $confirmation, $form, $entry ) {
if ( empty( $entry ) || rgar( $entry, 'status' ) === 'spam' ) {
// Return the default confirmation for spam.
return $confirmation;
}
// Check your condition here and replace the $confirmation if needed.
return $confirmation;
}, 11, 3 );https://stackoverflow.com/questions/72389753
复制相似问题