umbellularia
Forum Replies Created
-
Forum: Plugins
In reply to: [CF7 Google Sheets Connector] CF7 Google Sheet Connector Version 4.0 UpdatesPlugin was working well with the previous version.
I have updated, reauthenticated with Google (including new API code), and reconfigured everything.
But no matter what I do (including deleting and reinstalling plugin), the debug log continues to show an authentication error:[ERROR_MSG] => Auth, Invalid OAuth2 access token
What do I do?
- This reply was modified 5 years, 1 month ago by umbellularia.
OK, I’ve devised a hacky solution for this. I’m sure I’m not following best practices here (beginning with direct edits to the CF7 plugin source), so please do let me know if you note any bugs here, or better ways to accomplish this.
I am flagging form fields that I don’t want reset/cleared upon submission with a unique class name, like this:
[email* your-email autocomplete:email class:noResetOnMailSent]
Then in CF7’s main scripts.js, I have modified this portion:
if ( 'mail_sent' == data.status ) { $form.each( function() { this.reset(); } );
And changed it to this:
if ( 'mail_sent' == data.status ) { $form.each( function() { $.each( $(this)[0], function() { if (!($(this).hasClass("noResetOnMailSent"))){ $(this).not(':button, :submit, :reset, :hidden').val('').prop('checked', false).prop('selected', false); } } ); } );
This original portion of code, called upon the ‘mail_sent’ condition, resets the entire form to default values. The modified version iterates through each form element, clearing the ones that do not possess the “noResetOnMailSent” class name.
I hope this might help someone else, and doesn’t introduce too many other bugs into CF7. This should clearly be reworked into a separate plugin of its own accord, such that the CF7 core isn’t modified.