Tips and Tricks HQ Support Portal › Forums › WP eMember › eMember – Translating Please Login to view this content message
- This topic has 10 replies, 2 voices, and was last updated 6 years, 2 months ago by admin.
-
AuthorPosts
-
August 29, 2018 at 8:38 pm #15051Heather_GMember
Hello there,
I’m using WP 4.9.8, WP emember 10.1.2
I am using WPML and trying to translate “Please Login to view this content. (Not a member? Join Today!)” The default french text is a little different from what we’d like to use.
I am attempting to use the instructions laid out in this thread: https://support.tipsandtricks-hq.com/forums/topic/how-to-load-the-wp-emembers-language-file-from-another-folder
I’ve updated my function file within my child theme, however my custom language file isn’t being called. My language folder has been placed in my child theme. I’ve updated the path to “lang/fr.php” (I’ve also tried using the full URL, but that doesn’t seem to help.)
If I swap out my updated language file with the one loaded directly from the plugin, my custom text loads fine, so I don’t think I’ve messed up the file in any way.
Is there anything other than the path that I should be changing in the code listed in the thread I’ve referenced?
Thanks!
August 30, 2018 at 4:09 am #78438adminKeymasterIt is likely the path is a little incorrect (so it is failing to find the file). Can you share the code you added for this so I can check it?
August 30, 2018 at 3:14 pm #78439Heather_GMemberSure. Can I reply privately?
Thanks
August 30, 2018 at 9:25 pm #78440Heather_GMemberI realized that it doesn’t make much difference since I’m currently on a test site. Here’s the code:
add_filter('emember_language_loading_override', 'load_my_custom_emember_language');
function load_my_custom_emember_language()
{
$language_file = "http://69.195.124.204/~omsocorg/wp-content/themes/omsoc-child/lang/fr.php";
include_once($language_file);
return "custom-file-loaded";
}August 31, 2018 at 5:06 am #78441adminKeymasterThe issue is that you are using a URL. Most servers won’t let you include a file using URL value (for security reasons). So at the moment that include is just being rejected by the server. You need to use the server path of that file.
Your server path to that file will look something like the following:
/home/public_html/wp-content/themes/omsoc-child/lang/fr.php
August 31, 2018 at 2:47 pm #78442Heather_GMemberInteresting. I tried your suggested path (it matches the structure of my WP installation) and it didn’t work. I also tried to remove each folder in order one-by-one starting from ‘home’ until I was down to /lang/fr.php but nothing worked. I call the hosting company (I’m using Bluehost and am on a shared server) and they said there was no restrictions on using a file URL, so the original URL I used should have worked. (I wasn’t aware of the security risk so that interesting to think about, but regardless, I’m just trying to get this to work for now).
Any other ideas as to why it wouldn’t be working? Is there a way to redefine the string directly in my child theme’s function file?
Thanks
September 1, 2018 at 5:28 am #78443adminKeymasterThe path will definitely be the issue. Finding the unix path can be a little tricky. This is really developer type stuff so normally you shouldn’t have to worry about this. How are you determining that you have the correct server path?
I don’t know how good your PHP skills are so not sure if you can do the following.
Add an echo statement somewhere that will dump the server path to the plugin (that info can be used to figure out the other path that we need). The following code can be copied and pasted into your functions.php file to see what output it gives (then delete the code):
add_action('plugins_loaded', 'just_some_test_code');
function just_some_test_code(){
echo WP_EMEMBER_PATH;
}Copy and paste the path it outputs.
September 5, 2018 at 6:43 pm #78444Heather_GMemberI see. It is more complicated than I realized. My PHP skills are pretty basic, but I’m always happy to learn more. We did have a developer working on the site, but he was so challenging to work with, we had to cease working with him. Now I’m just trying to polish things up as best I can before launch.
And speaking of launch, the server isn’t pointing to the actual domain yet, do I need to wait until it is pointed to try to find the path to the file?
Thanks again for your help.
September 6, 2018 at 4:25 am #78445adminKeymasterThe path should remain the same. So you can get the path now and start using it (even though you haven’t pointed it to the actual domain yet).
September 7, 2018 at 3:55 pm #78446Heather_GMemberFor some reason the code you gave me wasn’t outputting anything. However I used the instructions I found here: https://www.wpwhitesecurity.com/absolute-path-webserver-php/
It outputted the following path: /home3/omsocorg/public_html/
I updated the path to: /home3/omsocorg/public_html/wp-content/themes/omsoc-child/lang/fr.php
But it still isn’t working.
Any ideas?
Thanks!
September 8, 2018 at 3:42 am #78447adminKeymasterI will reply to your email to get access to the site and check to see if the path is correct and if it is loading the file or not.
-
AuthorPosts
- You must be logged in to reply to this topic.