gocodebox / lifterlms

LifterLMS, a WordPress LMS Solution: Easily create, sell, and protect engaging online courses.
https://lifterlms.com
GNU General Public License v3.0
179 stars 134 forks source link

5.0 Forms added duplications of default forms with no way to delete duplicates #1685

Closed nrherron92 closed 2 years ago

nrherron92 commented 3 years ago

Reproduction Steps

Expected Behavior

Actual Behavior

Error Messages / Logs

Logs from the day of the update:


### System and Environment Information

<details>
<summary>System Report</summary>

<!-- Paste your System Report between the three backticks below this line -->

Wordpress

Home Url: [removed] Site Url: [removed] Login Url: [removed]/wp-login.php?itsec-hb-token=wplogit Version: 5.7.2 Debug Mode: Yes Debug Log: Yes Debug Display: No Locale: en_US Multisite: No Page For Posts: Blog (#181) [[removed]/blog/] Page On Front: Home (#130) [[removed]/] Permalink Structure: /%postname%/ Show On Front: page Wp Cron: Yes

Settings

Version: 5.0.1 Db Version: 5.0.1 Course Catalog: Course Catalog (#7) [[removed]/courses/] Membership Catalog: Membership Catalog (#8) [[removed]/memberships/] Student Dashboard: Members Dashboard (#60) [[removed]/members-dashboard/] Checkout Page: Purchase (#9) [[removed]/purchase/] Course Catalog Per Page: -1 Course Catalog Sorting: title,ASC Membership Catalog Per Page: 9 Membership Catalog Sorting: menu_order Site Membership: Not Set Courses Endpoint: my-courses Edit Endpoint: edit-account Lost Password Endpoint: lost-password Vouchers Endpoint: Autogenerate Username: yes Password Strength Meter: no Minimum Password Strength: medium Terms Required: yes Terms Page: Disclaimer and Terms of Use (#391) [[removed]/disclaimer-and-terms-of-use/] Checkout Names: required Checkout Address: hidden Checkout Phone: required Checkout Email Confirmation: yes Open Registration: no Registration Names: required Registration Address: hidden Registration Phone: required Registration Voucher: optional Registration Email Confirmation: yes Account Names: required Account Address: hidden Account Phone: required Account Email Confirmation: yes Confirmation Endpoint: confirm-payment Force Ssl Checkout: no Country: US Currency: USD Currency Position: left Thousand Separator: , Decimal Separator: . Decimals: 2 Trim Zero Decimals: no Recurring Payments: yes Email From Address: [removed] Email From Name: [removed] Email Footer Text: Email Header Image: 600 Cert Bg Width: 800 Cert Bg Height: 616 Cert Legacy Compat: no

Constants

LLMS_REMOVE_ALL_DATA: undefined LLMS_REST_DISABLE: undefined LLMS_SITE_FEATURE_RECURRING_PAYMENTS: undefined LLMS_SITE_IS_CLONE: undefined

Gateways

Authorize.Net: Disabled Authorize.Net Test Mode: Disabled Authorize.Net Logging: Authorize.Net Order: 1 PayPal: Enabled PayPal Test Mode: Disabled PayPal Logging: yes PayPal Order: 1 Stripe: Enabled Stripe Test Mode: Disabled Stripe Logging: yes Stripe Order: 1 Manual: Disabled Manual Logging: no Manual Order: 1

Server

Mysql Version: 5.5.5 Php Curl: Yes Php Default Timezone: UTC Php Fsockopen: Yes Php Max Input Vars: 5000 Php Max Upload Size: 512 MB Php Memory Limit: 512M Php Post Max Size: 512M Php Soap: Yes Php Suhosin: No Php Time Limt: 300 Php Version: 7.4.19 Software: Apache Wp Memory Limit: 40M

Browser

HTTP USER AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36

Theme

Name: WPCrafter LMS Version: 0.1 Themeuri: https://wpcrafter.com Authoruri: https://wpcrafter.com Template: generatepress Child Theme: Yes Llms Support: No

Plugins

AnyImage.io Integration: 2.0.0 Broken Link Checker: 1.11.15 Classic Editor: 1.6 Cookie Notice & Compliance for GDPR / CCPA: 2.0.4 Duplicate Page: 4.4 Elementor: 3.2.5 Elementor Addons & Templates - Sizzify Lite: 1.3.2 Elementor Pro: 3.3.1 Google Analytics Dashboard for WP (GADWP): 6.7.0 Google Analytics for WordPress by MonsterInsights: 7.17.0 GP Premium: 2.0.2 Health Check & Troubleshooting: 1.4.5 Imagify: 1.9.14 Insert Google Analytics Id: 1.1.3 iThemes Security Pro: 7.0.1 LifterLMS: 5.0.1 LifterLMS Advanced Quizzes: 1.1.1 LifterLMS Advanced Videos: 1.0.0-beta.14 LifterLMS Assignments: 1.1.12 LifterLMS Authorize.Net Payment Gateway: 1.1.0 LifterLMS ConvertKit: 2.1.0 LifterLMS Custom Fields: 1.0.2 LifterLMS Customizations: 1.0.0 LifterLMS MailChimp Add-on: 3.2.0 LifterLMS PayPal Gateway: 1.3.0 LifterLMS Social Learning: 1.3.0 LifterLMS Stripe Payment Gateway: 5.3.2 LifterLMS WPForms: 1.1.1 Mail On Update: 5.4.13 Nav Menu Roles: 2.0.1 Page Templater For Elementor: 1.2.9 PHP Compatibility Checker: 1.5.0 Uptime Robot Widget: 1.8.2 User Switching: 1.5.7 WP Content Copy Protection (Lite): 2.0.4 WP Crontrol: 1.10.0 WP File Manager: 7.1.1 WPForms: 1.6.7.1 WP Rocket: 2.10.7

Integrations

BbPress: No BuddyPress: No LifterLMS ConvertKit: No LifterLMS WPForms: Yes LifterLMS MailChimp: No LifterLMS Social Learning: No Videos: Vimeo: Yes Videos: Wistia: No Videos: YouTube: No

Template Overrides



</details>

This issue has be recreated:
+ [ ] Locally
+ [ ] On a staging site
+ [X] On a production website
+ [ ] With only LifterLMS and a default theme

### Browser, Device, and Operating System Information

+ Browser name and version
+ Operating System name and version
+ Device name and version (if applicable)
thomasplevy commented 3 years ago

@nrherron92 could you post the ticket ID please

nrherron92 commented 3 years ago

@thomasplevy jeez why aren't you psychic? :P HS-169488

thomasplevy commented 3 years ago

@nrherron92 I'm not sure if the errors have anything to do with this or not -- the "concerning" errors are from ithemes and from the action scheduler libraries upgrade routine. However, it looks to me like the upgrade wasn't from our upgraded version of action scheduler. Though I might be wrong about that...

In either event the database upgrade for LifterLMS happened about 8 minutes after the errors. I don't know if that means that the plugin itself was upgraded prior to that. If the errors happened during plugin upgrade it could have caused the duplicates to be created... However... the way the installation script works if it would have run twice it recreates the existing form post (like the tool does) instead of creating a second one.

All in all I'm a little puzzled by this... and I've read through all the code and I don't see a way this could have happened.

I do see there's a plugin installed allowing posts to be duplicated. Is it possible that this was accidentally run somehow? Seems unlikely that all 3 of the core forms would be accidentally duplicated.

The reason the duplicate's cannot be deleted is that we intentionally prevent users from deleting the "core" form posts. If they were to delete the checkout form it would break their site. This is intentional of course I didn't consider that a duplicate could somehow be created through WordPress conflict hell. So... the only way I can conceive of to actually delete a form would be to do so through the database, which is sticky.

Another note: duplicates aren't preventing anything from working. The queries to find the form are finding the first form for the location and using that one. So the form with the lowest ID (displayed first in the list) is the form being used. The second form in the list (the duplicates) are just taking up space and being annoying but not breaking anything.

The user should be able to do whatever is needed to be done to the first of each form location without issue while we figure out how to remove these duplicates.

How to remove the duplicates?

1) Do so through the database 2) I could build a tool to do this through LifterLMS -> Status -> Tools

I don't know how frequently this kind of freak thing might happen. It'll take me some time to write and test the tool and if this happens a lot it would actually be better to figure out why it's happening and prevent that instead of having a fixer tool... but maybe that's the best way to go.

We could do this with custom code but it would be code you'd want to add one time and then remove once they're deleted.

I don't know...

nrherron92 commented 3 years ago

HS-172506

thomasplevy commented 3 years ago

@nrherron92 do you see any errors or anything in this second instance that can help us correlate information between the two tickets? I don't have time to look into this today but if anything jumps out at you can you let me know

nrherron92 commented 3 years ago

@thomasplevy i got debug turned on but I don't see anything showing up when i open the duplicate form. However, he does have another issue with the pages where there is an error message that displays saying that the email field is mandatory and prompting to add it back in, but it then goes away once the edit page has loaded.

nrherron92 commented 3 years ago

HS-173636 --- maybe an interesting update with this user or maybe you already knew this but it looks like the duplicate forms have a creation date that matches the day you look at them. This user asked about the forms over the weekend but the date of the duplicate forms is today

thomasplevy commented 2 years ago

Resolved in #2108