-
Notifications
You must be signed in to change notification settings - Fork 197
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
WPML: Fix course outline for a course translation #7453
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## trunk #7453 +/- ##
============================================
+ Coverage 51.26% 51.49% +0.22%
- Complexity 11189 11234 +45
============================================
Files 614 622 +8
Lines 47259 47504 +245
Branches 407 414 +7
============================================
+ Hits 24229 24460 +231
- Misses 22703 22711 +8
- Partials 327 333 +6
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
e89b5be
to
7fcd4f4
Compare
]; | ||
|
||
const ALLOWED_CAP_CHECKS = [ | ||
const ALLOWED_HTML = array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still tend a use the []
. I suspect I should start using array()
, right?
Also, did you use something to change it automatically? Would be good to create a PR to fix it in the whole project already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct :)
I ran vendor/bin/phpcbf
, it fixed :)
$is_translated = apply_filters( 'wpml_element_has_translations', '', $lesson_id, 'lesson' ); | ||
if ( ! $is_translated ) { | ||
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound | ||
do_action( 'wpml_admin_make_post_duplicates', $lesson_id ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine it is the action that will duplicate the lessons when translating a course, right? Not sure if I'm doing something wrong, but it didn't create the translated lessons for me when translating a course. I did the following:
- Create a course with modules and lessons.
- Publish the lessons.
- Go to the course listing.
- Click on "+" to translate it.
- Translate the strings.
- Go to the listing and filter the posts by language.
- Edit the post in the translated language.
Then I see the following (course without modules and lessons):
And it seems they don't exist at all:
Here is the course I created to translate:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @merkushin!
As we talked, I was suspecting that maybe I pull the changes after my tests. Then I repeated it, and it duplicated the lessons without module properly.
But for the lessons inside modules, only one was duplicated, but even this one didn't show up on the course outline.
Resolves #7392
In this PR we address an issue with a course translation.
The easiest way to observe the issue is to create a translation for a course with lessons and check the Course Outline in the translated course.
To fix it, we need:
_lesson_course
meta field in translated (duplicated) lessons to point the new course.Proposed Changes
Testing Instructions
Pre-Merge Checklist