[Resolved] Include parent custom field value in form notification
This thread is resolved. Here is a description of the problem and solution.
Problem:
Include parent custom field value in form notification
Solution:
You can use the Toolset form hooks to add parent field using custom place holder:
- cred_body_notification_codes
- cred_subject_notification_codes
I am developing a Real Estate website and I want to give the user the ability to request informations about a certain property. I created CPT “INFO REQUEST” , the relationship between INFO REQUEST and PROPERTIES and proceeded to create a form in order to allow customers to request info about a certain property.
I am working on the web owner notification, and, besides the INFO REQUEST form data, I would like to add informations on what property the user wants to know more about, so I chose to insert Property name and Reference number.
If above code works you should remove the generic field "rifimmobile" you added to your form as its not required as we are fetching the value from database.
Dear Minesh, I tried but I got this error when trying to save the file functions.php:
"Le tue modifiche al codice PHP sono state annullate a causa di un errore alla linea 437 del file wp-content/plugins/cred-frontend-editor/application/views/dialogs/shortcodes/cred-relationship-form.phtml. Correggi e prova a salvare nuovamente.
Searching on the internet I found out that this might be a problem caused by PHP 8.0.
I reverted the php version to 7.4 and saved again, then I tried your code and it works perfectly.
When I replied I hit "I still need assistance" because I was just sending you the error I got from saving, but this ticket can in fact be closed!
If above does not work, please share admin access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
Minesh, your code was right the first time around.. maybe you read my message before I could edit and update it with the new infos I had by searching the error in the internet.
Everything works fine now, thank you so much. I assume with this code I can retrieve any custom field I want from a parent and use it in the form notification, which is super useful.
Thank you!