• Resolved Cris

    (@crispaor)


    Hi,

    I have EDD installed in spanish web but the verification email to access purchase history is in english. How can I translate it?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Mihai Joldis

    (@misulicus)

    Hi @crispaor,

    You could change that using the “edd_user_verification_email_message” filter from that email and custom code. You will need to get the existing message and then change it inside your custom function via the filter then return the changed text.

    Thread Starter Cris

    (@crispaor)

    Hi Mihai,

    I don’t know if I understand you correctly. Should I use this function and translate it?

    Plugin Support Mihai Joldis

    (@misulicus)

    You should use this filter inside the function

    $message    = apply_filters( 'edd_user_verification_email_message', $message, $user_id );

    That gives your access to the entire message contents inside the $message variable. You can then rewrite that message in the language you wish.

    Thread Starter Cris

    (@crispaor)

    I’m not a programmer and I don’t know where I should do it. I thought that adding that function to my theme would work but it shows me an error saying that that function already exists inside the EDD plugin folder
    Could you explain it to me more precisely, please?

    • This reply was modified 1 year, 4 months ago by Cris.
    Plugin Support Mihai Joldis

    (@misulicus)

    Hi.


    Please take the code below and add it inside your theme’s functions.php file or use a plugin like WPCode to add custom snippets to the site:

    function crispaor_translate_verify_email_to_spanish( $message, $user_id ) {
    
    	$user_data  = get_userdata( $user_id );
    
    	if( ! $user_data ) {
    		return;
    	}
    
    	$name = $user_data->display_name;
    	$url = edd_get_user_verification_url( $user_id );
    	$from_name  = edd_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
    
    	$message = sprintf(
    		/* translators: 1: User display name, 2: Site name, 3: Verification URL */
    		__( 'Hola %1$s,
    		
    
    		Su cuenta con %2$s debe verificarse antes de poder acceder a su historial de compras. <a href="%3$s">Haga clic aquí</a> para verificar su cuenta.
    
    		?Falta el enlace? Visite la siguiente URL: %3$s', 'easy-digital-downloads'),
    		$name,
    		$from_name,
    		esc_url_raw( $url ),
    		esc_url_raw( $url )
    	);
    	
    	return $message;
    }
    add_filter( 'edd_user_verification_email_message', 'crispaor_translate_verify_email_to_spanish', 10, 2 );
    • This reply was modified 1 year, 4 months ago by Mihai Joldis.
    Thread Starter Cris

    (@crispaor)

    Thanks a lot! But there is a problem: now I don’t receive the verification email. Obviously I use email accounts that I have never used.

    • This reply was modified 1 year, 4 months ago by Cris.
    Plugin Support Mihai Joldis

    (@misulicus)

    The verification email does not get sent all the time. This only runs when a user account already exists and a guest purchase is made with the account’s email address.

    Thread Starter Cris

    (@crispaor)

    The thing is that I made two purchases as a guest with differents accounts that I never used here and in neither of them did I receive the verification email. Is there any other way to receive that email to verify that it is working correctly? If there isn’t, I trust you ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Translate email’ is closed to new replies.