Skip Navigation

Open

Topic Tags: Compatibility

Overview of the issue

If you are using the Events Manager plugin, you may encounter an issue where ticket details for recurring events do not display translated in secondary languages.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open the …/wp-content/plugins/events-manager/classes/em-ticket.php file.
  • Look for line 150.
  • Replace:
    function __get( $var ){
    	if( $var == 'name' || $var == 'ticket_name' || $var == 'description' || $var == 'ticket_description' ){
    		$prop = $var == 'name' || $var == 'description' ? 'ticket_'.$var : $var;
    		if( EM_ML::$is_ml && !$this->ticket_parent && !empty($this->ticket_meta['langs'][EM_ML::$current_language][$prop]) ){
    			return $this->ticket_meta['langs'][EM_ML::$current_language][$prop];
    		}else{
    			return $this->{$prop};
    		}
    	}elseif( $var == 'event' ){
    
  • With:
    function __get( $var ){
    if( $var == 'name' || $var == 'ticket_name' || $var == 'description' || $var == 'ticket_description' ){
    	$prop = $var == 'name' || $var == 'description' ? 'ticket_'.$var : $var;
    
    	// WPML Workaround for compsupp-7315
    	if ( class_exists('Sitepress') 
    		&& isset( $this->ticket_id ) 
    		&& isset( $this->event->post_id ) ) {
    
    		$string_name = 'ticket_description_'.$this->ticket_id;
    		$textdomain = 'event-tickets-'.$this->event->post_id ;
    		$this->{$prop} = apply_filters('wpml_translate_single_string', $this->{$prop} , $textdomain, $string_name);
    
    	}
    	else if ( $prop == 'ticket_name' ) {
    		$string_name = 'Ticket Name:'.substr($this->{$prop}, 0, 20);
    		$textdomain = 'events-manager' ;
    
    		if ( apply_filters('wpml_default_language', NULL ) == apply_filters( 'wpml_current_language', NULL )) {
    			do_action( 'wpml_register_single_string', $textdomain, $string_name, $this->{$prop} );
    		}	
    
    		$this->{$prop} = apply_filters('wpml_translate_single_string', $this->{$prop} , $textdomain, $string_name);
    	}
    
    	if( EM_ML::$is_ml && !$this->ticket_parent && !empty($this->ticket_meta['langs'][EM_ML::$current_language][$prop]) ){
    		$check = $this->ticket_meta['langs'][EM_ML::$current_language][$prop];
    		return $this->ticket_meta['langs'][EM_ML::$current_language][$prop];
    	}else{
    		return $this->{$prop};
    	}
    }elseif( $var == 'event' ){
    
  • Visit the page with the issue in original language.
  • Go to WPML > String Translation page, search for the strings and translate them.

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>