Start your code hereadd_action(\'frm_after_create_entry\', \'create_detail_form_entry\', 20, 2);
To: item_meta' = FrmField::get_id_by_key("udy9s33334") => $user_idIs this what you meant?
Code Starts Here
Start your code hereadd_action('frm_after_create_entry', 'create_detail_form_entry', 20, 2); function create_detail_form_entry($entry_id, $form_id) { // Replace 123 with your Registration Form ID if ($form_id == 2) { $user_id = FrmEntryMeta::get_entry_meta_by_field($entry_id, zah2u); // Replace 'user_id_field' with the actual field key for user ID in your Registration Form // Check if an entry already exists in the Detail Form for this user $existing_entry = FrmEntry::getAll(array( 'it.form_id' => 43, // Replace 456 with your Detail Form ID 'meta_key' => 'udy9s33334', // Replace 'user_id_field' with the actual field key for user ID in your Detail Form 'meta_value' => $user_id )); if (empty($existing_entry)) { // Prepare the data for the Detail Form $detail_form_id = 43; // Replace 456 with your Detail Form ID $new_entry = array( 'form_id' => $detail_form_id, //'item_meta' => array( //old code item_meta' = FrmField::get_id_by_key("udy9s33334") => $user_id
//udy9s33334 => $user_id = (string), // Replace 'user_id_field' with the actual field key for user ID in your Detail Form 'udy9s33334' => $user_id, // Replace 'user_id_field' with the actual field key for user ID in your Detail Form // Add other default fields if necessary ), ); // Create the new entry in the Detail Form FrmEntry::create($new_entry); } } }
Start your code here
add_action('frm_after_create_entry', 'create_detail_form_entry', 20, 2); function create_detail_form_entry($entry_id, $form_id) { // Replace 123 with your Registration Form ID if ($form_id == 2) { $user_id = FrmEntryMeta::get_entry_meta_by_field($entry_id, zah2u); // Replace 'user_id_field' with the actual field key for user ID in your Registration Form // Check if an entry already exists in the Detail Form for this user $existing_entry = FrmEntry::getAll(array( 'it.form_id' => 43, // Replace 456 with your Detail Form ID 'meta_key' => 'udy9s33334', // Replace 'user_id_field' with the actual field key for user ID in your Detail Form 'meta_value' => $user_id )); if (empty($existing_entry)) { // Prepare the data for the Detail Form $detail_form_id = 43; // Replace 456 with your Detail Form ID $new_entry = array( 'form_id' => $detail_form_id, 'item_meta' => array( 'udy9s33334' => $user_id, // Replace 'user_id_field' with the actual field key for user ID in your Detail Form // Add other default fields if necessary ), ); // Create the new entry in the Detail Form FrmEntry::create($new_entry); } } }
Start your code hereadd_action('frm_after_create_entry', 'create_detail_form_entry', 20, 2); function create_detail_form_entry($entry_id, $form_id) { // Replace 123 with your Registration Form ID if ($form_id == 2) { $user_id = FrmEntryMeta::get_entry_meta_by_field($entry_id, 'zah2u'); // Replace 'user_id_field' with the actual field key for user ID in your Registration Form // Check if an entry already exists in the Detail Form for this user $existing_entry = FrmEntry::getAll(array( 'it.form_id' => 43, // Replace 456 with your Detail Form ID 'meta_key' => 'udy9s33334', // Replace 'user_id_field' with the actual field key for user ID in your Detail Form 'meta_value' => $user_id )); if (empty($existing_entry)) { // Prepare the data for the Detail Form $detail_form_id = 43; // Replace 456 with your Detail Form ID $new_entry = array( 'form_id' => $detail_form_id, 'item_meta' => array( 'udy9s33334' => $user_id, // Replace 'user_id_field' with the actual field key for user ID in your Detail Form // Add other default fields if necessary ), ); // Create the new entry in the Detail Form FrmEntry::create($new_entry); } } }
Please login or Register to submit your answer