dannyvanholten / acf-gravityforms-add-on Goto Github PK
View Code? Open in Web Editor NEWAdvanced Custom Fields: Gravityforms Add-on
Advanced Custom Fields: Gravityforms Add-on
Hi there, thanks for creating this plugin!
We use it for a lot of our projects.
For one of our projects however we are running into a performance issue.
This is because every time an ACF GravityForms field is rendered, it's actually getting all forms from the database.
And this specific website has approximately 300+ forms.
When we have a few occurencies of this ACF GF field on the edit page, it becomes really slow.
In this website, it's doing a lot of GFForms::get_form() queries because of this, resulting in 2901 database queries to get a form. In total, this could cause an extra page load time of up to 10 seconds.
Also see screenshot below of the Query Monitor tool.
There you can see that 7 times a single form is loaded from the database, it is caused by the field render of the ACF gravityforms plugin (which corresponds to the 7 ACF gravityforms fields on the edit-page screen).
We can easily change the behavior of the render_field
function in this plugin, to only load all the forms once.
I will attempt to create a PR for you today with this fix.
Hoping you'll be able to take a look if you agree with the fix.
Thanks in advance!
Plugin Website: https://www.gfrangeslider.com/
Issue
When the GF/ACF plugin is activated, the range slider fields do not render. When deactivated, they work again. I went through the GF/ACF and tried to debug it a bit myself: the GF/ACF plugin does not cause a conflict in any place that i can see except for the notifications class (Notices.php). I'm not exactly sure what part of it is causing the conflict, but it's a pretty small file? For right now, I just commented out the $this->addNotices();
from the class constructor, but this is obviously not a great long-term solution, so I was hoping that something could be done and integrated into the plugin for posterity.
Please let me know if you need any more information; happy to provide whatever you need and/or help in any way. Thanks!
It should also be possible to return just the ID of the form. Also it would be cool if the V4 field used the same function as the V5 field to process the Value.
It would be nice if the list of forms in the dropdown were sorted by title rather than ID.
/resources/Field.php
line 97
Replace
$this->forms = GFAPI::get_forms();
With
$this->forms = GFAPI::get_forms(true,false,'title');
When you have a multi-select form, and you have allow_null
set to true, you can lose a form output if you happen to select the first item in the dropdown.
I've attached a video of this occurring. Note the array index.
Will this plugin work with version 5 of Advance Custom Fields?
https://www.advancedcustomfields.com/resources/beta-test-version-5/
Hi,
First; Very handy plugin, thanks! :)
I do have a small bug, when activating your acf-gravityforms-add-on, the survey add-on from Gravity Forms breaks on the front-end. What happens is that the label is showed, but the html for the field is not showing up. I don't get any console errors ...
Thanks if you have a chance to take a look at it.
I can confirm that the recent version still working perfectly in the latest release of WordPress.
Hi! Love the plugin, but would it be possible to make the plugin queryable via graphql? This would come in handy as more sites move to a headless approach. Cheers!
I'm registering custom fields to Gravity Forms by extending the GF_Field class. See https://docs.gravityforms.com/gf_field/
For some reason whenever I have the ACF Gravityforms Addon activated the input of custom field I created using the method get_field_input
won't render. It looks like it doesn't get triggered.
To confirm this, I installed a new Wordpress site (using default theme), installed Gravity Forms, and the code for the custom field. Everything worked fine until I installed this addon. Deactivating the addon will fix the issue.
Hey guys. Since I am not working with WordPress anymore and I've switched to React for building websites at another company. I wanted to keep my plug-ins up-to-date but I am struggling to do so. Because of not having PHP, WordPress & several plugin licences but also because of motivation.
I'm therefore looking for (an)other person(s) who wants to improve, maintain & co-own the plugin. Please let me know if you're interested in this. I would like to keep the code quality high, so I will still review code together with you :)
Hope to find someone so we can get this plugin up-to-date again!
Hi there,
In the README is a link to the wordpress.org plugin page*, but there it says "Last updated: 2 years ago". The latest commits are from 2 months ago, though. Will this reflect in a new version on the wordpress.org plugin page eventually?
Thanks
I have a front-end Gravity form that I want to populate into custom fields for a custom post type, in this instance, called Portfolio...but it's only passing one value, not all selected for the checkbox fields from the form. I'm furthermore then using that entered data to display via shortcode (or merge tags if needed, but prefer acf shortcode) into the design of that Portfolio item in the front-end. I've been troubleshooting wondering if there's some conflict between plugins as I'm also using Gravity Forms + Custom Post Types plugin, but so far I am not sure yet. Any idea why this might be happening and/or how to fix it?
I actually want the actual plugin to activate in my hook if the plugin is there but inactive. Otherwise it should go the download page of that plugin
I have a need to add a disabled option once a form is chosen and saved. I have done this in the Field.php file myself. Wondering if a feature request like this is applicable?
This is more of a "developer" feature as there would be no need to disable the field otherwise.
Thanks for the quick plugin, it works great!
Hey, my client's site crashed because of this:
PHP Fatal error: require(): Failed opening required '/var/www/html/wp-content/plugins/acf-gravityforms-add-on/vendor/composer/platform_check.php' (include_path='.:/usr/local/lib/php') in /var/www/html/wp-content/plugins/acf-gravityforms-add-on/vendor/composer/autoload_real.php on line 25
all plugins are on latest version
Thanks for the great plugin!
I recently had a use case for excluding a certain form by its ID. Would it be possible to add a hook that would allow to filter the Gravity Forms that get into the field values?
I've added a form field to an options page, and it looks like nothing gets saved to the site options. When using AFC on options pages, the standard behavior is to create a site option with a 'options_'
prefix before the field key, e.g. if your field key was 'gravity_form'
, it creates a site option with the key 'options_gravity_form'
. Using this plugin, no options get saved to the database.
Thanks for making and maintaining this plugin, BTW. It's very handy, and works well.
<select multiple>
:
Could it be switched to a simple checkbox list?
In my projects, I'm using WPGraphQL to query data from WP as a headless CMS. With this, I use ACF and Gravity Forms. There are integration plugins that make it possible to query ACF fields and GF forms through WPGraphQL. This plugin handily provides the bridge between ACF and GF, but sadly, the field added by this plugin does not show up in the WPGraphQL schema. It would be very nice if this plugin could add support for this, or if a separate plugin would be created that would bridge the gap.
There is an open issue on the WPGraphQL for ACF repo (wp-graphql/wp-graphql-acf#249) that considers a similar issue. It seems like the effort to allow ACF extensions to work with WPGraphQL for ACF has stopped a while ago, but I still hope it would be possible to add support, potentially with some help from the WPGraphQL team.
Are there any plans on the horizon for supporting FA 5?
The latest update added require __DIR__ . '/platform_check.php';
to autoload_real.php on line 25, but there isn't a platform_check.php file to load. Commenting out that line fixed problems as near as I can tell.
Hi Danny,
My report is extremely similar to issue #23, and I really liked his text, so I'm going to reuse it if that's all right.
Your plugin is awesome, but I've run into a conflict with it.
I'm using the Gravity Forms Signature Add-On (https://www.gravityforms.com/add-ons/signature/) and when I install the ACF/GF Add-On the signature input field no longer appears in my forms. When I disable AFC/GF it appears again. More specifically, the label for the field appears, but the actual signature box does not.
I understand that you may not guarantee performance with optional add-ons, but I thought I'd let you know about the conflict, as it took me awhile to suss it out.
Thanks,
Josh
Hi - I have a problem with the Plugin.
Is use the latest Wordpress Version (4.7.3) and the latest ACFpro Plugin.
My Problem:
i choose a form, and save the Page. De Edit-Page Reloads every Field is saved, but not the Field for the Forms. Is this a Bug?
I'm trying to make forms appear in a repeater. When I use the code:
$form_id = get_field('my-form');
gravity_form($form_id);
I just get the error "Oops! We could not locate your form."
I have replace 'my-form' with the right custom field. Is this a known issue?
Okay, this is an issue I've encountered a few times on one particular site.
Whenever a form is submitted, it continously tries to submit via AJAX (this being the issue) despite saying to redirect to a thank you page in the form confirmation settings.
I've tested this by using the shortcode on a regular page, and that works fine.
I believe it is this plugin in particular, as the shortcode works fine in other ACF field groups.
Great plugin, thanks for this!
I've used it to associate instances of Gravity Forms with instances of a custom post type, which works well.
However, if I want to remove a previously selected form from a custom post it seems to work (if I return to edit the custom post the form is no longer selected) but when I query my custom posts in PHP and do a get_field(my_form_key) on them the original form ID still seems to be returned.
Have I omitted to do something necessary?
Great plugin, thanks for this!
I've used it to associate instances of Gravity Forms with instances of a custom post type, which works well.
However, if I want to remove a previously selected form from a custom post it seems to work (if I return to edit the custom post the form is no longer selected) but when I query my custom posts in PHP and do a get_field(my_form_key) on them the original form ID still seems to be returned.
Have I omitted to do something necessary?
Hi Danny,
Your plugin is awesome, but I've run into a conflict with it.
I'm using the Gravity Forms Coupon Add-On (https://www.gravityforms.com/add-ons/coupons/) and when I install the ACF/GF Add-On the coupon input field no longer appears in my forms. When I disable AFC/GF it appears again.
Edit: I also confirmed this bug is causing the 'Username' field to disappear.
I understand that you may not guarantee performance with optional add-ons, but I thought I'd let you know about the conflict, as it took me awhile to suss it out.
Thanks,
Adam
We create a multiple choices field in Gravity:
1: Fuu
2: Faa
3: Foo
We create a multiple choices field in ACF for same content type:
1: Fuu
2: Faa
3: Foo
When selected any of the values in Gravity Form let's say 1, 3, only first one is stored in ACF field (1.) In case of 2, 3, then only 2 value is stored in ACF field.
Is this related or even the same as #22 ? Why is this issue not in the scope of acf-gravitforms-add-on plugin? (we are paid customers)
Following a discussion with support to resolve an issue with gravityforms, I added the call gravity_form_enqueue_scripts more or less as by their instructions on https://www.gravityforms.com/embed-forms-using-code/ .
This could be further improved, but is sufficient for my case. It should at least be mentioned in the docs IMHO and could possibly be integrated in this plugin:
// Required for gravity forms
//
function gf_enqueue_required_files() {
GFCommon::log_debug( __METHOD__ . '(): running.' );
$form_object = get_field('form');
if(!empty($form_object) && isset($form_object['id'])) {
// print '<!-- calling gravity_form_enqueue_scripts '.$form_object['id'].'-->'.PHP_EOL;
gravity_form_enqueue_scripts($form_object['id'], true);
}
}
add_action( 'get_header', 'gf_enqueue_required_files' );
```
Is there an ability to specify a default form? On the site I'd like to use this on, I'd rather it not be the first form in the list in case my client accidentally forgets to change it. Otherwise, thank you for this plugin!
If there are a lot of forms, this overloads the server when visitors come to the site. As the forms are only needed in the backend, the constructor needs to be modified so that frontend calls don't load the forms.
Hi there,
I'm trying to count the number of entries in a particular selected form. The code I use manually is:
$summary = RGFormsModel::get_form_counts(4);
But if I want to instead echo the count of the form selected, for instance, I've tried:
$sales_form = get_field('associated_order_form');
$summary = RGFormsModel::get_form_counts($sales_form['id']);
and it doesn't work. What am I doing wrong here?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.