clareQ
We are using the plugin Tutor LMS which says it is WPML compatible. On our site is a sidebar generated by Tutor LMS. The links always come out formatted wrong.
Like this: hidden link
Rather than like this: hidden link
I found the section of code that generates it and it uses the function trailingslashit() which I see WPML says it supports here: https://wpml.org/errata/changes-in-the-way-wpml-handles-the-trailing-slashes-in-url-conversion/
This is the section of code from Tutor LMS that generates it:
public function get_tutor_dashboard_page_permalink( $page_key = '', $page_id = 0 ) {
if ( $page_key === 'index' ) {
$page_key = '';
}
if ( ! $page_id ) {
$page_id = (int) $this->get_option( 'tutor_dashboard_page_id' );
}
return trailingslashit( get_permalink( $page_id ) ) . $page_key;
}
Ahmed Mohammed
Supporter
Timezone:
Africa/Cairo (GMT+02:00)
Hi there,
Thank you for contacting WPML support!
I understand that you're using TutorLMS, and the tutor dashboard URL is constructed incorrectly as follows: hidden link .
It looks like you're using Language name added as a parameter as the language URL format under WPML → Languages.
Could you please test switching to Different languages in directories and let me know if the issue is still there?
Looking forward to hearing back from you.
clareQ
Hi there, yes if I switch to directories it seems to resolve the issue. Is this a known bug that will be fixed?
Ahmed Mohammed
Supporter
Timezone:
Africa/Cairo (GMT+02:00)
Hi there,
> yes if I switch to directories it seems to resolve the issue.
Oh! Glad to hear that.
> Is this a known bug that will be fixed?
I have checked our records, and I could not find a report for that issue. So it needs to be reported to our compatibility team and TutorLMS team.
I have created this sandbox website: hidden link - could you please replicate the issue there and I will take it from there.
Looking forward to hearing back from you.
clareQ
Hi ok thanks. I contacted Tutor LMS about this and they said they were in contact with WPML about it. I am not sure if they actually are though!
I have installed tutor LMS and you can see the problem on this page: hidden link
Ahmed Mohammed
Supporter
Timezone:
Africa/Cairo (GMT+02:00)
Hi there,
> I contacted Tutor LMS about this and they said they were in contact with WPML about it. I am not sure if they actually are though!
I can see that TutorLMS team is working with our compatibility team but I could not a specific report for this specific issue.
> I have installed tutor LMS and you can see the problem on this page: hidden link
Thank you! I'm going to take this to our compatibility team and I will keep you posted whenever I have more information.
In the meantime, please let us know if you have any further questions. We're always happy to help!
Ahmed Mohammed
Supporter
Timezone:
Africa/Cairo (GMT+02:00)
Hi there,
I appreciate your patience while we were working on this.
Our compatibility team found a workaround for this issue and will work with the plugin's author to fix it permanently.
The workaround is to edit this file: /wp-content/plugins/tutor/classes/Utils.php
Change:
return trailingslashit( get_permalink( $page_id ) ) . $page_key;
to
if (apply_filters('wpml_setting', false, 'language_negotiation_type') == 3) {
$permalink = get_permalink($page_id);
$permalink = remove_query_arg('lang', $permalink);
$my_current_lang = apply_filters('wpml_current_language', NULL);
$url = trailingslashit($permalink) . $page_key;
$url = apply_filters('wpml_permalink', $url, $my_current_lang);
return $url;
} else {
return trailingslashit(get_permalink($page_id)) . $page_key;
}
Could you please try it and let me know how it goes?
Looking forward to hearing back from you.
clareQ
Thank you Ahmed the workaround you provided seems to work
Ahmed Mohammed
Supporter
Timezone:
Africa/Cairo (GMT+02:00)
Hi there,
> Thank you Ahmed the workaround you provided seems to work
Super glad to hear that 🙂
Our compatibility team will work with the plugin's author to implement this fix permanently.
I'm marking this ticket as resolved for now. Whenever you require any further assistance, please feel free to open a new ticket.