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 14 replies, has 4 voices.

Last updated by ooluja 8 years, 3 months ago.

Author Posts
May 3, 2011 at 5:16 am #27193


The new beta release includes the WPML media plugin:
Following are the current issues we are working on:

  • Add language filtering in the Media popup when inserting to posts
  • Add a custom field for posts that controls duplicating attachments
  • Auto-duplicate attachments when saving posts in the default language
  • Auto-adjust 'featured image' if image translation exists
  • The setup message doesn't go away

Please add any feedback or suggestions here.

May 3, 2011 at 12:05 pm #27195


Is WPML Media plugin working on WPML

May 3, 2011 at 12:20 pm #27196


It's in Beta version. Most of the functionality is there, but we're still working on it.
It's OK for testing, but don't use on production sites. We're trying to have a first working release by the end of this week.

May 3, 2011 at 12:33 pm #27197


Oh ok, ty 🙂

May 4, 2011 at 10:20 am #27198


Ok, here is some first feedback:
1. php error in line 69
When editing a single attachment, I get this php error:

Warning: Missing argument 2 for WPML_media::manage_media_columns() in /srv/www/vhosts/ on line 69

Obviously the method manage_media_columns() is beein called with only 1 parameter but expects two:

function manage_media_columns($posts_columns, $detached) {
		$posts_columns['language'] = __('Language', 'wpml-media');
		return $posts_columns;

Since the second parameter is not used at all in this method, I simply removed it so the first line now looks like this:

manage_media_columns($posts_columns) {

Seems to work for me.
2. the configuration reminder doesn't go away
I just inserted these two lines after the comment to only show the message once after installation (line 41):

					if (!$this->settings['initial_message_shown']) {
						add_action('admin_notices', array($this, '_initialize_message'));
						// hide message afterwards
						$this->settings['initial_message_shown'] = true;
						update_option('wpml_media_settings', $this->settings );

3. links to other language versions on "edit attachment" screen
well, these are still missing, but you're probably aware of that 😉
4. duplicating attachments of selected posts / pages
I was a little bit stupid: Since I configured english as the default language but actually attached the (german) images I wanted to translate to the german version of the page, I didn't see the button to duplicate the images from the original post (because there were no images attached to the original post).
So I actually coded my own routine into the "Media translation" page, that allows me to duplicate only attachments for a given post id. It works and I could post the changes I made as a diff in another comment, but it's kind of obsolete since I discovered, that I just have to work "the right way": upload english images to the english page first, and then just use the buttons on the german and portuguese pages to duplicate the images from the original post.
It would be nice though, if there would be a way to duplicate images from the german to the english post even with english as the default language. But it's not that important for the first version of this plugin - it's just that I couldn't see the buttons until I did things in "the right order", so maybe there should be a notice for first time users.
That's it for now, I'm going to put the site online within the next days, so people can see the media translation plugin at work 🙂

May 5, 2011 at 11:00 am #27199


I found two more issues - here's the first one including a fix:
5. when duplicating attachments, the meta key '_wp_attached_file' ist not set
Obviously WP itself can do without this meta key, but the original attachment has this meta and the duplicates should have it too. Why? Because there are probably many plugins or themes that use the function get_attached_file() to get the attachment url and this function relies on that meta key. (for example the plugin 'file gallery' which could be perfectly integrated with the new media translation plugin)
So it would be nice if you could add one line just after

update_post_meta($dup_att_id, 'wpml_media_duplicate_of', $att_id);

The additional line could be like this:

update_post_meta($dup_att_id, '_wp_attached_file', get_attached_file($att_id) );

This additional line would greatly reduce later support questions about "why are the translates images not showing in the frontend?"
The second bug follows in my next post, first I'd like to put the site on line so I can give you a link for demonstration...

May 5, 2011 at 12:25 pm #27200


here is the next issue - again including a fix 😉
6. language switcher links to wrong urls on attachment pages
When I visit the attachment page for a translated attachment on the frontend, the language switcher links to an url with an additional language prefex if the current language. Of course only, if you use the /en/ and /de/ url prefix scheme.
So when I visit hidden link the english button links to hidden link - but it should omit the "/de/" here. The link to the portuguese version (from the german version) is then hidden link.
To fix it, there needs to be one additional line added in the function filter_link(). Right after this line:

$link = str_replace('&lang='.$current_lang, '', $link);

add this line:

$link = str_replace('/'.$current_lang.'/', '/', $link);

and everything works fine. 🙂
BTW: You can see the plugin at work now: hidden link
P.S: Please ignore issue #4 above for now - I'm going to post a followup. I would edit my post (because it contains some wrong information), but it seems, I cannot edit older posts...

May 5, 2011 at 12:41 pm #27201


Found a bug:
My Media library have 550 images, 37 post on my default language (Croatian) and 1 post on English.
After pressing the "Scan All" button, the media plugin processed all images, and successfully created copy images for this 1 translated post.
But, during the processing procedure, the Media plugin puts some images from default languages posts to "Unattached" section in Media Library automatically, don't know why. :/

May 5, 2011 at 7:04 pm #27202


Second bug:
The button "Scan and duplicate attachments" seems not to work, at least for me with custom post type. When clicking on it, the process start but nothing happens after.

May 6, 2011 at 4:59 am #27205


Bruce, I found the problem. This happen when you translate some post with the translation editor and before the completion of the translation you close the page or go back instead of clicking on "Translate".
Bruce, what's up with the button "Scan and duplicate attachments"? It's not working just for me or?

May 6, 2011 at 8:03 am #27203


Hi Matthias,
Thanks for the feedback and contributions. Most of the issues you have raised have now been addressed.
3. links to other language versions on "edit attachment" screen This is still on the todo list.
We hope to have a new beta release out soon.

May 6, 2011 at 8:16 am #27204


Hi ooluja,
I've found and fixed a problem that may have caused it to put some images to "Unattached".

May 6, 2011 at 10:01 am #27206


Bruce, I found the problem. This happen when you translate some post with the translation editor and before the completion of the translation you close the page or go back instead of clicking on "Translate".
Bruce, what's up with the button "Scan and duplicate attachments"? It's not working just for me or?
woops, something happened to the forum :/ double post srry

May 6, 2011 at 10:05 am #27207


Ooluja, Can I get a DB dump plus your theme so I can check this. It's working ok on my test system. I'll send you an email you can reply to.

May 6, 2011 at 10:29 am #27208


DB dump and theme sent.

The topic ‘[Closed] WPML media plugin’ is closed to new replies.