Passer au contenu Passer à la barre latérale

Open

Topic Tags: Compatibility

Overview of the issue

If you are using the RSVP Pro plugin, you may encounter issues where some strings do not display as translated on the frontend when using WPML. This problem typically arises due to the string’s unique key exceeding the character limit set by the system, resulting in mismatched keys and untranslated strings.

Workaround

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

  • Open the app/public/wp-content/plugins/rsvp-pro-plugin/includes/rsvp-utils.inc.php file
  • Look for line 1069.
  • Replace:
    function rsvp_pro_get_dynamic_translated_string( $key_name, $string, $event_id ) {
    	$text = $string;
    
    	if ( function_exists( 'pll__' ) ) {
    		$text = pll__( $string );
    	}
    
    	if ( has_filter( 'wpml_translate_string' ) ) {
    		$event_name = rsvp_pro_get_event_name( $event_id );
    		$package    = array(
    			'kind'  => "RSVPPro - {$event_id}",
    			'name'  => "rsvp-pro-plugin-{$event_id}",
    			'title' => "RSVP Pro Plugin - {$event_name}",
    		);
    		$key_name   = strtolower( $key_name );
    		$key_name   = str_replace( ' ', '-', $key_name );
    		$text       = apply_filters( 'wpml_translate_string', $string, $key_name, $package );
    	}
    
    	return $text;
    }
    
  • With:
    function rsvp_pro_get_dynamic_translated_string( $key_name, $string, $event_id ) {
    	$text = $string;
    
    	if ( function_exists( 'pll__' ) ) {
    		$text = pll__( $string );
    	}
    
    	if ( has_filter( 'wpml_translate_string' ) ) {
    		$event_name = rsvp_pro_get_event_name( $event_id );
    		$package    = array(
    			'kind'  => "RSVPPro - {$event_id}",
    			'name'  => "rsvp-pro-plugin-{$event_id}",
    			'title' => "RSVP Pro Plugin - {$event_name}",
    		);
    		$key_name   = strtolower( $key_name );
    		$key_name   = str_replace( ' ', '-', $key_name );
    
    		// WPML Workaround for compsupp-7503
    		$key_name = substr($key_name, 0, 160);
    		
    		$text       = apply_filters( 'wpml_translate_string', $string, $key_name, $package );
    	}
    
    	return $text;
    }
    

Laisser une réponse

Veuillez rester sur le sujet et être respectueux envers les autres. Si vous avez besoin d'aide pour des problèmes non liés à ce message, utilisez notre Forum de Support pour démarrer une discussion ou soumettre un ticket.

Vous pouvez utiliser ces balises :
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>