gocodebox / lifterlms-rest

LifterLMS REST API Feature Plugin
6 stars 7 forks source link

Changing the Parent_ID for a lesson trigger using the API triggers an error #289

Closed nrherron92 closed 2 years ago

nrherron92 commented 2 years ago

Reproduction Steps

Expected Behavior

Actual Behavior

Error Messages / Logs


### 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 Version: 5.9.3 Debug Mode: No Debug Log: No Debug Display: Yes Locale: nl_NL Multisite: No Page For Posts: Not Set Page On Front: Orbis Academy (#787) [[removed]/] Permalink Structure: /%category%/%postname%/ Show On Front: page Wp Cron: Yes

Settings

Version: 6.4.0 Db Version: 6.4.0 Course Catalog: Courses (#1134) [[removed]/courses/] Membership Catalog: Membership Catalog (#17) [[removed]/?page_id=17] Student Dashboard: Not Set Checkout Page: Orbis Academy Login (#18) [[removed]/login/] Course Catalog Per Page: 9 Course Catalog Sorting: title,ASC Membership Catalog Per Page: 9 Membership Catalog Sorting: menu_order,ASC Site Membership: Not Set Courses Endpoint: my-courses Edit Endpoint: edit-account Lost Password Endpoint: lost-password Vouchers Endpoint: redeem-voucher Autogenerate Username: no Password Strength Meter: no Minimum Password Strength: Terms Required: no Terms Page: Not Set Checkout Names: Checkout Address: Checkout Phone: Checkout Email Confirmation: no Open Registration: no Registration Names: Registration Address: Registration Phone: Registration Voucher: Registration Email Confirmation: no Account Names: Account Address: Account Phone: Account Email Confirmation: no Confirmation Endpoint: confirm-payment Force Ssl Checkout: no Country: NL Currency: EUR Currency Position: left Thousand Separator: . Decimal Separator: , Decimals: 2 Trim Zero Decimals: no Recurring Payments: no Email From Address: [removed] Email From Name: [removed] Email Footer Text: Email Header Image: Cert Bg Width: Cert Bg Height: Cert Legacy Compat:

Constants

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

Gateways

Handmatig: Disabled Handmatig Logging: Handmatig Order: 1

Server

Mysql Version: 10.4.18 Php Curl: Yes Php Default Timezone: UTC Php Fsockopen: Yes Php Max Input Vars: 1000 Php Max Upload Size: 64 MB Php Memory Limit: 256M Php Post Max Size: 64M Php Soap: Yes Php Suhosin: No Php Time Limt: 30 Php Version: 7.4.16 Software: Apache/2 Wp Memory Limit: 40M

Browser

HTTP USER AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0

Theme

Name: Orbis Academy Version: 1.0.0 Themeuri: [removed] Authoruri: https://www.orbis-software.nl Template: Divi Child Theme: Yes Llms Support: No

Plugins

Cookie Notice & Compliance for GDPR / CCPA: 2.2.3 Enable Media Replace: 3.6.3 Insert PHP Code Snippet: 1.3.3 LifterLMS: 6.4.0 LifterLMS Advanced Quizzes: 2.0.1 LifterLMS Advanced Videos: 1.0.0-beta.18 LifterLMS Assignments: 1.3.0 LifterLMS Custom Fields: 2.0.2 LifterLMS Customizations: 1.0.0 LifterLMS Labs: 1.6.0 Limit Login Attempts Reloaded: 2.24.1 Rank Math SEO: 1.0.87 Rank Math SEO PRO: 3.0.10.1 reSmush.it Image Optimizer: 0.4.2 Wordfence Security: 7.5.9

Integrations

BbPress: No BuddyPress: No Videos: Vimeo: No Videos: Wistia: No Videos: YouTube: Yes

Template Overrides



</details>

### This issue has been recreated:

+ [ ] Locally
+ [ ] On a staging site
+ [ ] 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)
pondermatic commented 2 years ago

This issue is caused by an undefined $parent_course_id variable that causes the parent_course metadata to not be removed, which causes update_post_meta() to fail because the metadata hasn't changed.

https://github.com/gocodebox/lifterlms-rest/blob/1.0.0-beta-24/includes/server/class-llms-rest-lessons-controller.php#L151

eri-trabiccolo commented 2 years ago

fixed in #288