דלג על ניווט

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.

השאר מענה

אנא הישארו בנושא והיו מכבדים לאחרים. אם אתה צריך עזרה בבעיות שאינן קשורות לפוסט הזה, השתמש בפורום התמיכה שלנו כדי להתחיל צ'אט או לשלוח כרטיס.

תוכל להשתמש בתגים הבאים:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>