dano1999
Forum Replies Created
-
Forum: Plugins
In reply to: [LearnPress - WordPress LMS Plugin] Issue with Polylang on user profile pageInteresting to hear your issue right now. Funny enough (not funny, it’s frustrating) is that I have a similar issue. I am using languages English and French. When I’m on a Forum user’s profile as a signed in user, and click the language switcher. It redirects me to the default home page (instead of showing me the user’s profile Im viewing in French).
I’m not sure why it is doing this issue, but I need to view the logs to see what error is forcing it to the default home page as a failsafe redirect.
Currently I have a site using LearnDash, bbPress (Forum), and Polylang. I had to download LocoTranslate in order to make manual translations on strings on the Plugin level.
For your issue, I had to solve the links not updating on my site too for a similar bug. What I did was update the theme function.php file with a custom verifier that would 1) check if the language was in X (X = desired language), 2) then verify that the user was logged in. From there I executed some Javascript to update a given id/class href target location for the tag. This way your labels will still translate (as they are doing) but you can manually change the URL href target to your desired location. Yes, it’s a bit crude/taxing on the loading time. But it works, and it is working fine for my project.
if (get_locale() == ‘fr_CA’) {
// check login
//
if (is_user_logged_in()) {/// Now We Edit the Class text and href
?>
<script type=”text/javascript”>
document.addEventListener(“DOMContentLoaded”, function() {
var links = document.querySelectorAll(‘a.ct-button’);
links.forEach(function(link) {
link.href = “target link”; // New href
});
});
</script>
<?php
}
else{
return “”;
}}
Something like this above should work when you implement it for each of your links you need to update. So in your case, I would use id’s and then update he target href accordingly. Hope this helps to some degree with your issue and I wish the best mate.