fabianlindfors
Forum Replies Created
-
Forum: Plugins
In reply to: [Advanced Forms for ACF] Contact form for listingsHi, Mike! I’m sorry about the late reply, been pretty busy. 🙂
This is definitely possible and a perfect use case for Advanced Forms. You can set up a form with email notifications and select which field to get the recipient address from.
For saving the form data you could either write some code to create a new custom post type and save the data on a form submission or you could use the pro version which comes with this feature built-in.
To let the authors review the forms you could write a tiny bit of code to fetch all generated posts associated with them (my plugin only handles form related functionality).
Hope this helps!
Forum: Plugins
In reply to: [Advanced Forms for ACF] Email recipient based on select optionHi! Thank you James for helping out.
The way James is suggesting (with a select field) is very nice but won’t work if you are planning on sending to multiple recipients. To achieve this you would have to write a tiny bit of code using the
af/form/email/recipient
filter. Here’s an example:function form_email_recipients( $recipients ) { $field_value = af_get_field( 'field_name' ); if ( 'option_1' == $field_value ) { return array( 'address1@test.com', 'address2@test.com', 'address3@test.com' ); } if ( 'option_2' == $field_value ) { return array( 'address4@test.com', 'address5@test.com' ); } return $recipients; } add_action( 'af/form/email/recipient/key=FORM_KEY', 'form_email_recipients' );
Don’t forget to replace FORM_KEY with your form key.
Hope this helps! 🙂
Forum: Plugins
In reply to: [Advanced Forms for ACF] Redirecting based on form selectionHi!
There is no filter to edit the args after a form has been submitted (that could potentially mess with a few things). The way I would do this is to simply hook into the af/form/submission action and trigger your own redirect using wp_redirect!
Here’s an example of redirecting if a certain field is a certain value:
function redirect_after_form_submission() { $field_value = af_get_field( 'field_name' ); if ( 'REDIRECT' == $field_value ) { wp_redirect( 'https://google.com', 302 ); } } add_action( 'af/form/submission/key=FORM_KEY', 'redirect_after_form_submission' );
Don’t forget to replace FORM_KEY with your form key. 🙂
- This reply was modified 5 years, 7 months ago by fabianlindfors.
Forum: Plugins
In reply to: [Advanced Forms for ACF] File size validationI’m looking into this but haven’t fixed it yet. Will get back to you!
Forum: Plugins
In reply to: [Advanced Forms for ACF] Notification not workingThat’s weird! You shouldn’t have to do anything else to activate notifications. Could you screenshot your form notification settings and send them here?
Thanks!
Forum: Plugins
In reply to: [Advanced Forms for ACF] Send email to current userUnfortunately you would have to write a tiny bit of code to achieve this, but it isn’t to hard. Something like this should work:
function filter_email_recipient( $recipient ) { $user = wp_get_current_user(); // Check if current user exists if ( $user->ID != 0 ) { return $user->user_email; } return $recipient; } add_filter( 'af/form/email/recipient/key=FORM_KEY', 'filter_email_recipient', 10, 1 );
Replace FORM_KEY with your form key. 🙂
Hope this helps!
Forum: Plugins
In reply to: [Advanced Forms for ACF] Format “from” name in e-mailHi! You sure can. A format that has worked for me in the past is:
Company Name <email@company.com>
!Hope this helps 🙂
Forum: Plugins
In reply to: [Advanced Forms for ACF] Is there a anti spam/anti robot field?Hi! There is no built-in such functionality. The plugin you linked might work but I haven’t tried it myself.
Good luck!
Forum: Plugins
In reply to: [Advanced Forms for ACF] Possible to get output in input format?Hi! I’m really glad to hear you’re enjoying AF 🙂
Your use case seems to be perfect for my plugin. One way to go about this is to use the pro version of my plugin. It comes with support for creating and editing posts automatically so you could save form submissions as a custom post type and then let visitors edit them again afterwards!
If buying the pro version is not reasonable you can of course achieve this yourself with a bit of code! My plugin has a filter called
af/field/prefill_value
which you can use to pre-fill form fields. You could hook into this hook and then retrieve the saved data from the database and populate your fields.Hope this helps!
Forum: Plugins
In reply to: [Advanced Forms for ACF] How to get AF entries with phpOh, I see! Yes, ACF does have a very favorable license. I opted into a yearly license to ensure I can continue updating and supporting the plugin.
If you regret your purchase we do offer a 30-day money back guarantee. You can create a support ticket here: https://hookturn.io/contact/
Sorry about the confusion! 🙂
Forum: Plugins
In reply to: [Advanced Forms for ACF] How to get AF entries with phpI’m sorry, on which page does it say lifetime updates?
- This reply was modified 5 years, 7 months ago by fabianlindfors.
Forum: Plugins
In reply to: [Advanced Forms for ACF] How to get AF entries with phpI’ll consider adding that! Seems like a nice function to have. 🙂
Thank you for purchasing AF Pro! For clarification our licenses are for 1 year of updates and support but cover an unlimited amount of installs.
Sorry about that! Will release version 1.5.4 soon also with the fix. 🙂
You are right! I seem to have accidentally removed a line of code. I fixed it now and you can get an updated version with the fix by downloading from Github: https://github.com/advancedforms/advanced-forms
Thank you so much for pointing this out to me! 🙂
Forum: Plugins
In reply to: [Advanced Forms for ACF] How to get AF entries with phpHi! That’s a very nice solution and a common use case. AF Pro includes the ability to create and edit posts if you are interested!
You don’t need to use the add_post_meta function either. My plugin has a helper function called
af_save_all_fields
which can automatically save all fields to a post. Use it like this:af_save_all_fields( $post_id );
For future reference, the generated entries are actually regular custom post types and can be fetched using a regular WP_Query targeting the
af_entry
post type. The field data is saved as regular ACF fields and can be retrieved withget_field
.Glad you figured it out!