I am using the User Registration Addon with GF 1.8.22 to build a customer portal where they can register and upload their documents for an attorney to review.
The form is avaiable here:
Once they upload and pay then their account is flagged with user meta update to paid state and a notification is sent to the attorney email.
The one thing that I can't see clearly is how to add a second File Upload to the form that is not visible on the front-end of the site. This is to be the area where the attorney or staff will upload the prepared files for the client to view/download. This action will trigger another notification email to the client to alert them that their documents are ready for review.
The file upload for the prepared files will be done by editing the entry for the form by the administrator or other user with that role.
So my question is, how might I have that 2nd file upload field in the form but hidden on the front-end so that it can be edited? I want the prepared forms file upload area separate from the user submitted file area.
And what hook would I use to trigger a notification when the file area has files added to it?
The action you are trying to trigger will be extraneous of GF. You will need to set a new custom field for the backend (there are lots of custom field solutions like ACF and Types for this). To start, we will use the entry as a post or you will need the current beta version of GF to hit their new actions. Then you will hit the save_post action or new GF action that recognizes when it goes from blank to a new value to send the noticed, or try to hook into the new 1.9 GF actions.
We don't need a form on the frontend, so we are set there. If this sounds right to you I will write some code to get you started.
I am not sure how the Post entered into process. Are you talking about creating a post upon form submission and then adding a custom field to the post?
What new actions are we discussing in 1.96 GF?
Thanks for the feedback
1 - You can hide the field on the front-end via the "Visibility" setting. Set it to "Admin Only" ([[LINK href="http://grab.by/ElQO"]]like so[[/LINK]]).
2 - You can use the [[LINK href="http://www.gravityhelp.com/documentation/page/Gform_after_update_entry"]]gform_after_update_entry[[/LINK]] hook to trigger the notification.
It passes the $entry_id as the second parameter. You can use the GFAPI::get_entry( $entry_id ) to fetch the full entry object, check if the admin-only upload field has been populated (by field ID), and then use [[LINK href="https://gravityplus.pro/how-to/programmatically-trigger-gravity-forms-notification/"]]GFCommon::send_notifications()[[/LINK]].
Hope this helps. :)
I am aware of the Admin Only visibility setting and I am currently using that.
I am pursuing an alternative solution to this problem and I have the initial coding done. I use a separate form and send the user id and the files to the user meta for the client.
I noticed that when it stores files it stores like this:
I am trying to retrieve the files and list them in an unordered list but my PHP is too limited. Can you show me example code to split the files out and list them in <li> elements?
Of course, it's JSON encoded. Okay, I figured it all out.