php Gravity Perks //嵌套表单//在父表单提交上复制父条目属性

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Gravity Perks //嵌套表单//在父表单提交上复制父条目属性相关的知识,希望对你有一定的参考价值。

<?php
/**
 * Gravity Perks // Nested Forms // Copy Parent Entry Properties on Parent Form Submission
 * http://gravitywiz.com/documentation/gravity-forms-nested-forms/
 */
// Update "123" to your parent form ID.
add_action( 'gform_entry_created_123', function( $entry, $form ) {

	// Specify which properties you would like to populate from the parent.
	// Supports: id, form_id, post_id, date_created, is_starred, is_read, ip, source_url, user_agent, currency, payment_status, payment_date, payment_amount, payment_method, transaction_id, is_fulfilled, created_by, transaction_type, status, date_updated, last_payment_date
	$copy_from_parent = array( 'transaction_id', 'payment_date', 'payment_status' );

	// Specify the field ID of the Nested Form field on your parent form.
	$nested_form_field_id = 1;

	$child_entry_ids = explode( ',', rgar( $entry, $nested_form_field_id ) );
	foreach( $child_entry_ids as $child_entry_id ) {
		foreach( $copy_from_parent as $parent_property ) {
			GFAPI::update_entry_property( $child_entry_id, $parent_property, $entry[ $parent_property ] );
		}
	}

} );

以上是关于php Gravity Perks //嵌套表单//在父表单提交上复制父条目属性的主要内容,如果未能解决你的问题,请参考以下文章

php Gravity Perks //嵌套表单//保存并继续清除会话Cookie

php Gravity Perks // GP嵌套表单//从值隐藏产品名称

php Gravity Perks //嵌套表单//每小时Cron和孤立条目到期

php Gravity Perks // GF嵌套表单//自动附加文件上传到父表单通知

php Gravity Perks //嵌套表单//在提交时强制{Parent}合并标记替换

php Gravity Perks // GP嵌套表单//通过用户注册附加组件映射完整的子项数据