在 $entry 对象中找不到 Wordpress Gravity Forms Dropbox link
Wordpress Gravity Forms Dropbox link not found in $entry object
我正在使用 WordPress gravity forms 和 dropbox 插件在 dropbox 上上传文件
我正在尝试在使用 PHP 提交表单后检索保管箱 link
正如文档所说,我应该能够在条目对象中找到 link
https://docs.gravityforms.com/gf_field_dropbox/#-entry-value
但我只找到 WordPress 上传 link 虽然当我查看我的条目时,保管箱 link 就在那里
这是我在当前主题
的 functions.php 中使用的代码
add_action( 'gform_after_submission', 'post_to_third_party', 10, 2 );
function post_to_third_party( $entry, $form ) {
$value = rgar( $entry, '158' ); // id of the field that holds the dropbox link
$files = json_decode( $value, true );
foreach ( $files as $file ) {
print_r($file);
}
foreach($entry as $child) { // also trying to print all entry properties but found nothing
echo $child . "<br>";
}
$value1 = GF_Field_Dropbox::get_value_export( $entry, '158' ); // trying export function in the docs but gives the same as first $value
print_r($value1);
}
有什么方法可以访问表单提交后 link 生成的保管箱?
使用这个
设法获得生成的保管箱link
add_action( 'gform_dropbox_post_upload', 'get_dropbox_urls', 10, 3 );
function get_dropbox_urls( $feed, $entry, $form ) {
print_r('started get drobbox');
foreach( $form['fields'] as &$field ) {
// NOTE: Replace 3 with your Dropbox field id.
$field_id = 158;
print_r($field_id,'the field id', $field);
if ( $field->id != $field_id ) {
continue;
}
// Get the field value.
$field_value = $entry[ $field->id ];
// Exit if field value is empty.
if ( rgblank( $field_value ) ) {
return;
}
// Decode JSON string.
$files = json_decode( stripslashes_deep( $field_value ), true );
print_r($files);
}
}
我正在使用 WordPress gravity forms 和 dropbox 插件在 dropbox 上上传文件 我正在尝试在使用 PHP 提交表单后检索保管箱 link 正如文档所说,我应该能够在条目对象中找到 link https://docs.gravityforms.com/gf_field_dropbox/#-entry-value 但我只找到 WordPress 上传 link 虽然当我查看我的条目时,保管箱 link 就在那里 这是我在当前主题
的 functions.php 中使用的代码add_action( 'gform_after_submission', 'post_to_third_party', 10, 2 );
function post_to_third_party( $entry, $form ) {
$value = rgar( $entry, '158' ); // id of the field that holds the dropbox link
$files = json_decode( $value, true );
foreach ( $files as $file ) {
print_r($file);
}
foreach($entry as $child) { // also trying to print all entry properties but found nothing
echo $child . "<br>";
}
$value1 = GF_Field_Dropbox::get_value_export( $entry, '158' ); // trying export function in the docs but gives the same as first $value
print_r($value1);
}
有什么方法可以访问表单提交后 link 生成的保管箱?
使用这个
设法获得生成的保管箱linkadd_action( 'gform_dropbox_post_upload', 'get_dropbox_urls', 10, 3 );
function get_dropbox_urls( $feed, $entry, $form ) {
print_r('started get drobbox');
foreach( $form['fields'] as &$field ) {
// NOTE: Replace 3 with your Dropbox field id.
$field_id = 158;
print_r($field_id,'the field id', $field);
if ( $field->id != $field_id ) {
continue;
}
// Get the field value.
$field_value = $entry[ $field->id ];
// Exit if field value is empty.
if ( rgblank( $field_value ) ) {
return;
}
// Decode JSON string.
$files = json_decode( stripslashes_deep( $field_value ), true );
print_r($files);
}
}