This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This thread is resolved. Here is a description of the problem and solution.

Problem:The WPRentals theme has a custom user dashboard for property owners. The links to edit individual properties always lead to the original language post.

Solution: The theme stores the dashboard links in transients. The transient values cannot be translated so the links will always lead to the original language. I got it to work by modifying the wpestate_get_template_link function in wprentals/lib/help_functions.php

Relevant Documentation:

This topic contains 9 replies, has 2 voices.

Last updated by Fernando Nobrega 1 year, 4 months ago.

Assigned support staff: Ricardo Alday.

Author Posts
May 18, 2018 at 12:20 pm

Fernando Nobrega

Hi. I'm having difficulty after changing language on WP Rentals theme. I have already contacted the developer's theme, but they have informed me that this specific situation is related to how WPML works.

The main language of my site is Portuguese. Everything works perfectly. I can change the language into English and I can see the properties in English.
The problem arises when the user tries to add a description in the English version of his property. To see that, you login, go to Minhas Propriedades, change the language to English and click on Edit Property.. The website will open the Portuguese version and not the English, as expected.

It seems that the edit links do not have /en/ .... and although the user changes the language to English, the editing page always opens in Portuguese.

The page in question is hidden link

And you can login with the test user:
user: ricardo
pw: emcima

May 21, 2018 at 5:05 pm #2203022

Ricardo Alday

Hi Fernando,

Thanks for contacting support.
I checked the site and although the properties can be translated in the backend. I'm not sure if WPML supports the frontend owner dashboard. I will need to run some test and get feedback from our compatibility team. Is it ok with you if I install the Duplicator plugin to download a copy of your site for local testing?

May 21, 2018 at 5:08 pm #2203084

Fernando Nobrega

Hello Ricardo,

Yes please.

Looking forward to hear good news about this issue
Thanks a lot

May 21, 2018 at 7:59 pm #2203989

Ricardo Alday

Thanks. I went through the theme code and found out that the theme stores the dashboard links in transients. The transient values cannot be translated so the links will always lead to the original language.
I got it to work by modifying the wpestate_get_template_link function in wprentals/lib/help_functions.php on llne 2771 from this:

if( !function_exists('wpestate_get_template_link') ):
    function wpestate_get_template_link( $template_name ){  
        
        $template_link = get_transient( 'wpestate_get_template_link_' . $template_name );
        if( $template_link === false ) {   
            $pages = get_pages(array(
                'meta_key'      => '_wp_page_template',
                'meta_value'    => $template_name
            ));

            if( $pages ){
                $template_link = get_permalink( $pages[0]->ID );
            }else{
                $template_link='';
            }
           set_transient('wpestate_get_template_link_' . $template_name,$template_link,60*60*24);
        }



        return $template_link;
    }
endif; // end  

to this

if( !function_exists('wpestate_get_template_link') ):
    function wpestate_get_template_link( $template_name ){  
        
        //$template_link = get_transient( 'wpestate_get_template_link_' . $template_name );
        //if( $template_link === false ) {   
            $pages = get_pages(array(
                'meta_key'      => '_wp_page_template',
                'meta_value'    => $template_name
            ));

            if( $pages ){
                $template_link = get_permalink( $pages[0]->ID );
            }else{
                $template_link='';
            }
           // set_transient('wpestate_get_template_link_' . $template_name,$template_link,60*60*24);
        //}



        return $template_link;
    }
endif; // end  

You should contact the theme author and ask her/him if that will affect anything else (so far, nothing has broken in my local copy) of if there's a better method.

Let me know if it works for you.

Thanks,
Ricardo

May 21, 2018 at 8:47 pm #2204161

Fernando Nobrega

These are really Great news Ricardo!!

I will ask them and will get back to you after that.. probably tomorrow morning.

Thanks

May 22, 2018 at 11:51 am #2207696

Fernando Nobrega

Great Ricardo,

This fix worked perfectly and did not affect anything else on the site. *Thank you*.

There is another issue related to how WPML works, that the theme developer has no solution and has indicated to us that you guys could have a solution. I do not know if I should open another ticket, or if I can continue with this one, taking advantage of the fact that you already have a copy of our site working on your side.

Here is the situation:

When an owner confirms a reservation on their dashboard, the property availability calendar is only automatically updated in the base language version (Portuguese). To update the calendar of the English version of the property, we must manually edit the property in the wordpress backoffice and click publish / save. Only then does the calendar in English get updated. The same happens with the owners that have iCal links configured do synchronize with other services, only updates the base language and always obliges the admin to edit the property to update on English as well.

Is it possible to fix something in WPML so that the process becomes automatic?

Thank you for your support

May 22, 2018 at 6:02 pm #2210912

Ricardo Alday

Hi Fernando,

Can you open a new ticket for that? You can assign it to me.
It's just to keep things organized here but in the meantime, I'll investigate with the copy I already have.

Thanks,
Ricardo

May 22, 2018 at 6:14 pm #2211155

Fernando Nobrega

Sorry Ricardo,

I have created a new ticket here:
https://wpml.org/forums/topic/wpml-does-not-copy-the-calendar-to-other-languages/

... but how can I assign it to you??

Thanks

May 22, 2018 at 7:34 pm #2211490

Ricardo Alday

I assigned the ticket to me 🙂

Feel free to close this ticket now and we'll continue on the new ticket.

Thanks.

May 22, 2018 at 7:37 pm #2211494

Fernando Nobrega

Ricardo, thank you very much for this fix!!
You are a great professional