Viewing 15 replies - 1 through 15 (of 17 total)
  • You need to update the plugin to also update the wpml tables in the database:

    Add this after set_post_type( $post_id, $new_post_type_object->name ); in the pluginfile

    /* --------------------  WPML SUPPORT ---------------------*/
    		/* http://wordpress.org/support/topic/post-type-switcher-bug-with-wpml */
    
    		// in case of using the WPML plugin
    		if(function_exists('icl_object_id')){
    			// adjust field 'element_type' in table 'wp_icl_translations'
    			// from 'post_OLDNAME' to 'post_NEWNAME'
    			// the post_id you look for is in column: 'element_id'
    
    			if($post->post_type == 'revision'){
    				if(is_array($post->ancestors)){
    					$ID = $post->ancestors[0];
    				}
    			} else {
    				$ID = $post->ID;
    			}
    				global $wpdb;
    
    				$wpdb->update(
    					$wpdb->prefix.'icl_translations',
    					array(
    						'element_type' => 'post_' . $new_post_type_object->name,	// string
    					),
    					array(
    						'element_id' => $ID,
    						'element_type' => 'post_' . $post->post_type
    					)
    				);
    
    				$wpdb->print_error();
    			}
    		}

    Thank you for posting this! Will test asap…

    Watch out, there is a ‘}’ to much at the end.

    Btw. thank you for the code! 😉

    Hot damn! Works like a charm – you’ve just made my day, cheers! 😀
    -jennyb

    Hi! WPML guys offer free subscription for plugin developers. As I do have the same problem, I encourage the plugin developer to contact them and work on WPML compatibility!

    Here it is the link: http://wpml.org/purchase/theme-and-plugin-developers/

    Thanks!

    It Works! Thank you!!!

    great stuff, it works!

    rob_teamworks

    (@rob_teamworks)

    I can’t get this to work. I pasted in the code (and removed the extra } ) after the line specified, tried to switch my custom post type to a different custom post type but it didn’t work. The english came across but the translation didn’t.

    Do I need to change the code in any way? I pasted in exactly.

    Hey guys!

    This hack works great, but any ideas how i can recover the 250+ pages that I had already converted before installing wpml?? Anyone able to do that yet?
    WPML support has been no help at all.

    Hey aaronrobb,

    Why would pages be lost before converting? A bit unclear on the prob…If you’ve already converted post types, you may just need to configure WPML to accept translating them. So check WPML > Translation management > Multilingual content setup, and make sure the post type is set to translate. If not, do so and you should be good.

    hope that helps!
    -jennyb

    Hey Rob (teamworks),

    Did you get your issue sorted? You had left a comment on my blog post about this subject…which I answered, but silly me, my blog doesn’t have email notifications for comments so not sure if you saw…let me know! 🙂

    best,
    -jennyb

    Hi Jenny

    What i mean is that i converted 250 or so of my posts to pages with Post Type Switcher, then installed WPML and they are all gone in the admin Page list area.

    I’ve looked into the translation management area, but Pages are a normal thing to be translated, as its not a custom post.

    The pages still exist on the front end, but even when i click Edit Page from the front end, it still doesn’t give me the ability to add a translation….

    Thoughts?

    Heya aaronrob,

    Ok, so not custom post types, but simple Pages. Interesting. And if you deactivate WPML do they appear in the admin again? Can I ask what version of WPML you’re using and which modules are installed?

    thnx,
    -jennyb

    Hey Jenny

    Yep they appear when WPML is disabled.

    And testing it out, i added the extra code to fix the problem, with WPML active, then if i go into one of the ‘missing’ pages through the front end, convert it back to Post, hit update, and then back to Page, it then shows up in the pages list.

    So the code above is working, but just not on pre-existing converted pages….

    Running the most recent WPML(3.1.5), and also just installed the Translation Mangement and String Translation plugins to try them out as well.

    Thanks for looking into this.
    I can give you admin access too if needed.

    Heya,

    And so you’re using this plugin w/ hack because you have more posts to convert after translating?
    Because it seems like otherwise this particular fix wouldn’t apply to you. You don’t need to convert with translations, but before making them.

    Here’s another idea, with WPML activated, toggle languages using the admin language switcher (admin bar). Maybe the pages were saved, but not as the correct language, or at least not as the language you’re viewing the admin in. You only see English content when viewing in English, for example, unless you choose the “all languages” option.

    standing by 🙂
    -jennyb

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Confilct with WPML plugin’ is closed to new replies.