We have converted a multilanguage site using WPML to a wordpress multisite installation.
Now using another plugin for multilanguage purposes, everthing is ok besides the Download Monitor plugin that has problems with the url rewrite. Does not attach the PDF if clicked in one or the other language.
How can do a debugging or rewrite.
Thanks
see this site: try to switch between german and english content and download a pdf on german page (works), english (get error with PDF)
http://www.viktorschuehle.ch/horizon/praxis/
english version:
http://www.viktorschuehle.ch/horizon/en1/epraxis/
Dbranes answers:
So you want to remove the language slug from the download urls?
For example use:
http://www.viktorschuehle.ch/horizon/download/8978/
on the english version, instead of
http://www.viktorschuehle.ch/horizon/en1/download/8978/
<strong>Update:</strong>
I can see that the pdf file from:
http://www.viktorschuehle.ch/horizon/en1/download/8978/
is corrupted.
You can modify the downloadable link with the <em>dlm_download_get_the_download_link</em> filter.
Here's a simple example (untested):
add_filter( 'dlm_download_get_the_download_link', 'wpse_download_link', 99, 3 );
function wpse_download_link( $link, $obj, $version_id ) {
// Modify link here
$link = str_replace( 'en1/', '', $link );
return $link;
}
if you need to adjust the links regarding the language slugs.
This can be extended to automatically fetch all the language slugs and remove them from the downloadable links.
So in this case:
http://www.viktorschuehle.ch/horizon/en1/download/8978/
should be delivered as:
http://www.viktorschuehle.ch/horizon/download/8978/
which sounds what you're after.
Dbranes comments:
ps: I updated the answer with a filter example.
Dbranes comments:
... or you can try not to translate the "download" custom post type: see [[LINK href="https://github.com/download-monitor/download-monitor/issues/126"]]here[[/LINK]].
Frank K comments:
What you mean by translating "download" post type ?
We need multilanguage uploads in the future. What would be solution to have english downloads on one page and the other language on the other blog ?
Dbranes comments:
If you're using WPML one can decide to translate custom post types under <em>Translation Options</em> in the admin menu.
I'm still not sure how your setup is:
<blockquote>We have converted a multilanguage site using WPML to a wordpress multisite installation.
</blockquote>
So you've created a subsite1 under the example.com multisite, and now you've activated WPML for that subsite:
Where example.com/subsite1/ (german) and example.com/subsite1/en1/ (english) are your language parts?
<blockquote>Now using another plugin for multilanguage purposes, everthing is ok besides the Download Monitor plugin that has problems with the url rewrite. </blockquote>
So you're not using WPML? What plugin are you using instead ?
<blockquote>Does not attach the PDF if clicked in one or the other language.</blockquote>
Do you want to use the same DLM shortcode in the English and the German content? For example:
[download id="123"]
<strong>Some short tests with DLM+WPML on a multisite subsite1:</strong>
When I try to translate a download item, to English and German, I get two different id's for each file.
For example: "German file" with id: 1 and "English file" with id: 2.
When I use the following shortcode in a German post content:
[download id="1"]
I get a downloadable link to the "German file" when viewing that post:
example.com/subsite1/download/1
When I add the same shortcode into the English translated post:
[download id="1"]
I get automatically a downloadable link to the "English file" when viewing that post:
example.com/subsite1/download/2
So this seems to work ok on my setup, unless I'm misunderstanding something ;-)
Reigel Gallarde answers:
I tried downloading both languages and all works...
english: [[LINK href="http://www.viktorschuehle.ch/horizon/en1/download/8978/"]]http://www.viktorschuehle.ch/horizon/en1/download/8978/[[/LINK]]
not english: [[LINK href="http://www.viktorschuehle.ch/horizon/download/8976/"]]http://www.viktorschuehle.ch/horizon/download/8976/[[/LINK]]
Frank K comments:
HI,
that did not solve the issue. Deleted that file but nothing changed
Farid answers:
Hi,
I have visited both of those given links and tried to download the PDF files by switching the language. There was no issue in downloading the PDF files as pointed in the following screenshot.
: http://screencast.com/t/3CfNz5YU
However, when I click on the other link it redirects to a 404 page. This is because your current permalink settings is set to the <strong>Post Name</strong> under <strong>Settings >> Permalinks</strong> page, but the links you gave to those anchors are pointing to <strong>Default</strong> (by ID) permalinks.
Helping screenshot: http://screencast.com/t/Zxv4qakBkBSw
To fix this issue there are two ways:
1) Change your permalink settings back to <strong>Default</strong> as displayed in the following screenshot.
: http://screencast.com/t/8N1Ub1M810
2) Go back and change those links/anchors urls (you added on those pages you mentioned above) again with urls (by post name) again.
Regards,
Eff Jay
Farid comments:
Hi Frank?
Did you try my solution?
Regards
Frank K comments:
I tried to edit the permalink structure but no luck. Did not change anything
timDesain Nanang answers:
dlm_uploads folder was protected by .htaccess
you can try rename or delete .htaccess file under:
domain/wp-content/uploads/dlm_uploads/