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 topic contains 8 replies, has 3 voices.

Last updated by Jamal 3 months ago.

Assigned support staff: Jamal.

Author Posts
June 21, 2019 at 7:32 am #4065213

sandiB-2

Tell us what you are trying to do?
I'm allowing my users to upload some sensitive files to the servers so I set up a protected folder that the files are being uploaded to. The files in this folder are not directly accessible.
I don't want to translate those attachments but would like to show the same language on all languages.
I'm retrieving the attachment posts in the background per user and displaying them but I only get them to display in the language they have been uploaded and all other languages are blank.
I've tried setting the attachments to show original language if not translated but it doesn't work.
If I disable the media translations plugin it works fine but then I don't have media translated on other parts of the page.
Do you have any solution?

June 21, 2019 at 5:11 pm #4068699

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Thank you for contacting WPML support. I'll be happy to help you with this. Please try going to WPML -> Settings and scroll to the bottom. Here, you can click the Start button to sync the media files to the other languages.

Also, as for the Media Translation plugin, are you using different images per language? If not, you can still translate the image title, caption, description, etc with just the core plugins. Media Translation is only needed to display different images per language.

Please let me know if you need any further assistance and I will be happy to help.

June 27, 2019 at 3:03 pm #4101133

sandiB-2

Hi Lauren
The sync media files isn't working as the files are protected from direct access.
And yes I do need the duplicate media for other parts of the website.

June 27, 2019 at 6:55 pm #4102297

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

The posts that these attachments are uploaded with - is this a custom post type? Can you walk me through how the client submits the file, and how you display it on the frontend?

I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**

- Please make a backup of site files and database before providing us access.

- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link

June 28, 2019 at 4:13 pm #4109363

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Okay, thanks for the additional details. Let's check to see if these fields you are using are stored in WPML -> Settings -> Custom Fields. You can click "Show System Fields" to look through all fields. If you find the one you are using to set the attachment, try setting it to copy. You may need to resave the post in order for the field to copy.

If that doesn't work, maybe translating the user type will? To edit this, go to WPML -> String Translation. At the bottom of the page there is a More Options section. Here, click Edit to translate different User Types. Does this make any difference?

July 1, 2019 at 9:22 am #4116893

sandiB-2

I set the custom field to copy and tried uploading another attachment. I also set the media attachment to translatable but fallback to original language if not translated. Nothing of those work.
What type of user do you want me to translate as there are many options. I'm not exactly fixing this on some specific user type.
I have also translated the files in media translations, but they still don't show.
I'm using ajax to get the contents if that could be an issue?

July 2, 2019 at 10:40 am #4125837

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Lauren is on vacation. If you don't mind I would like to continue with you on this forum thread.

I am not really sure to understand very well your use case. But i can suggest to use 'suppress_filters' => false in your get_posts call.

private function get_post_query($user_id = null) {
    if(!$user_id) $user_id = get_current_user_id();
    $args = array(
        'suppress_filters' => false, // <= add this line
        'post_type' => 'attachment',
        'post_status' => 'inherit',
        'numberposts' => -1,
        'meta_query' => array(
            array(
                'key' => 'user_access',
                'value' => $user_id,
            )
        ),
    );
    return get_posts( $args );
}

If this does not help. Please explain more about your use case. Where is located this protected folder? How do you handle upload in the first hand? How you handle download too? If you could point us to different parts of your code that are responsible for this workflow.

Best regards,
Jamal
WPML Support

July 9, 2019 at 10:53 am #4169831

sandiB-2

Well unfortunately this also didn't help.
The upload folder is located in /uploads/fsqm-files and this folder is protected via .htaccess (redirection on direct access)
The upload is done via a form and the uploaded files are saved as wordpress attachment with a custom key 'user_access' with the value of the user id that uploaded them.
On display I check for current user Id an match it to user_access key as you can see from the post query you copied. And this query doesn't give me the translated results.

July 11, 2019 at 7:08 am #4186537

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for your feedback. To investigate this issue without affecting your website, I have created a test server on our platform and sent you instructions to migrate your website there. Please see my private message(JULY 11, 2019 AT 7:04 AM).

Please, also, tell us how we can reproduce this issue from scratch.
What form to use to upload the media?
If we should test with a specific user, or can we use the user you provided us?
Where is the custom codes that are being used for upload and for showing the media in the my-account results page?

Thank you,
Jamal

The topic ‘[Closed] Media translations from secure folder’ is closed to new replies.