Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lead flood #12

Closed
soulseekah opened this issue Jun 19, 2013 · 21 comments
Closed

Lead flood #12

soulseekah opened this issue Jun 19, 2013 · 21 comments
Labels

Comments

@soulseekah
Copy link
Owner

Each save creates a new lead. This appears to have unwanted consequences. Needs more research and a good solution.

@soulseekah
Copy link
Owner Author

Leads generated also seem to trigger notifications and counters whether we like it or not... :(

@soulseekah
Copy link
Owner Author

All pending leads have a status of 'pending' and should not generate stuff... right?

soulseekah added a commit that referenced this issue Mar 29, 2014
By default we now don't send any notifications when saving (these were
being sent due to a bug in Gravity Forms 1.8, see issue #12). A new
setting has been added to the notifications screen where a notification
can be forced to be sent if the "Send on save" setting is checked for
the notification.
@soulseekah soulseekah added feedback and removed bug labels Mar 29, 2014
@alisalama
Copy link

Hi,

Great plugin, but I'm using it in a project and I'm seeing similar issues.

Every time there is a 'Save', two leads are generated, and therefore two notification emails go out. Neither of which are ideal.

If I remove this line it does seems to work fine...

GFFormDisplay::process_form( $form_id );

But I'm wondering if there are any further implications if I do that?

Cheers

@soulseekah
Copy link
Owner Author

Are you using the latest master.zip version? https://github.com/soulseekah/Gravity-Forms-Saved-Forms-Addon/archive/master.zip

Cause this was fixed in 24121c0

@alisalama
Copy link

Yeah, I'm using 4.3.1.

I thought it was maybe something I had done, or a plugin conflict or something, so created a fresh wordpress install, latest gravity forms, one simple form and was still having the issue.

Am I misunderstanding? Is it supposed to save twice for some reason?

@soulseekah
Copy link
Owner Author

I'm talking about the version of this addon. The Gravity-Forms-Saved-Forms-Addon are you using this download https://github.com/soulseekah/Gravity-Forms-Saved-Forms-Addon/archive/master.zip to get it?

@alisalama
Copy link

Yeah I am.

@alisalama
Copy link

Just wondering if you have any idea of the reason why this happens?

@soulseekah
Copy link
Owner Author

Are you positively sure you're using the latest version of my plugin (download https://github.com/soulseekah/Gravity-Forms-Saved-Forms-Addon/archive/master.zip)? Because this issue was raised and fixed in March.

@alisalama
Copy link

Yeah definitely. I swapped to the one you just sent, same issue. Then I did a comparison of the two folders (one you sent and one I was using) just to be sure, and they are identical.

I've included the Gravity form log, you can clearly see it creating two leads.
http://pastebin.com/9Y0YtFu2

@soulseekah
Copy link
Owner Author

Err, can you check whether you have the option "Send on save" in the Form Settings checked?

@alisalama
Copy link

Yeah it is set to true.

@soulseekah
Copy link
Owner Author

You should uncheck that button if you don't want notifications of saved forms being sent out.

@alisalama
Copy link

I see. My issue is more that it is generating two leads, and even if I uncheck that it still generates twice? Obviously this isn't that efficient, I'm looking at a fairly large number of records so doubling that could have a large impact.

So the design is to generate it twice?

@soulseekah
Copy link
Owner Author

All the partial generated leads have a status of 'pending' and should not be triggering any notifications (unless "Send on save" is checked). The design is to generate as many pending leads as there are "saves" on a form. If you save the form 7 times you'll have 7 pending leads.

There is, however, a cleanup function that allows you to remove all pending leads in one go on the "pending completed entries" screen. You just hit that button and all incomplete saved forms are removed.

As for the bug with a notification still being sent, please send me the latest version of Gravity Forms to gennady[at]kovshenin[dot]com and I'll try to take a look at it in the coming weeks, and if I'm able to reproduce the issue I'll gladly fix it.

@alisalama
Copy link

I see. The issue that is occuring is that if I save the form 7 times, I see 14 pending leads in the database.

See attached screenshot. Two leads created automatically on 1 save, and both tagged as pending.

localhost___localhost___wordpressoriginal___wp_rg_lead_meta___phpmyadmin_4_2_10_and_wordpress_wp-content_uploads_gravity_forms_logs_gravityforms_txt

If I remove the line...

GFFormDisplay::process_form( $form_id );

... then it works fine? Is there any reason not to do this, or is this a fix?

@soulseekah
Copy link
Owner Author

I'll let you know within a couple of weeks hopefully, that function there is for multipage support; if you remove it multipage forms will not be saved correctly. You have to remember that this plugin is one big hack, because Gravity Forms is so awkwardly designed it's really tough to get it going. It worked perfectly fine on some versions, then once a release is rolled out it stops working. I hate Gravity Forms, seriously.

@alisalama
Copy link

Thanks, I'm finding the same. I've built a fairly extensive application based upon gravity forms, and although the back end form builder side is great, it is causing me a few issues on the front end.

Thanks again for your help.

@alisalama
Copy link

Ok, spent a bit of time tracing it through, and have a slightly less 'hacky' fix (still a bit hacky but better), than just commenting out the process_form call.

I figured out it is saving two leads because there is an 'init' hook in the gravityforms.php which is called after the first lead is submitted, which runs through the whole form submission process a second time and as result submits twice.

The function (maybe_process_form) that it hooks in to has this check at the top, though so if it fails on the second loop through then it won't be processed.

$form_id = isset( $_POST['gform_submit'] ) ? absint( $_POST['gform_submit'] ) : 0;
if ( $form_id ) {
    ...
}

So, after the form has been processed in maybe_save_confirmation, just set it to fail the check...

/* Spoof the page number and make-believe */
$_POST[ "gform_target_page_number_{$form_id}" ] = 65535;
require_once( GFCommon::get_base_path() . '/form_display.php' );
GFFormDisplay::process_form( $form_id );

/* Set the second form being submitted so the second attempt fails */
$_POST['gform_submit'] = 0;

Seems to work fine.

@soulseekah
Copy link
Owner Author

I looked at Gravity Forms 1.9 and they introduced a "Save and Continue" feature. I think that there's no point in trying to fix this, but rather leverage their Save and Continue mechanisms to provide form states, restores, notifications.

I'm closing this issue as no longer valid as of GF 1.9. A new issue has been opened at #29

Thank you for your input.

@soulseekah
Copy link
Owner Author

e4ed4c0 fixes the above issues and becomes less hacky and dirty thanks to the new "Save and Continue" feature in Gravity Forms 1.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants