Forum Replies Created

Viewing 15 replies - 1 through 15 (of 32 total)
  • Thread Starter NixXxon23

    (@nixxxon23)

    Thanks a lot. Works like a charm ??

    Thread Starter NixXxon23

    (@nixxxon23)

    p.S.: Downgrade to older version solved the issue. Still I would love to know where the issue comes from?!

    Would be awesome if you could have a look on the staging site: https://staging16.vorlagenportal.at/dokumente/vereinbarung-eines-ausbildungskostenrueckersatzes/

    Hi,
    sorry for hijacking this topic but I had exactly the same issue on https://www.vorlagenportal.at your release candidate from github resolved it for me. Hope you include the changes in the next update.

    Thanks again and BR;
    Niko

    Thread Starter NixXxon23

    (@nixxxon23)

    Thanks again for your fast reply. It was not a failure with your plugin.

    If someone else stumbles across this topic. This was the solution:
    If e.g. “.picker” is the selector for the datetime-field –> this targets just the input container, not the input directly. Check if adding input solves the problem. The new selector (in my case) is “.picker input”

    I will mark this topic as resolved.

    Thread Starter NixXxon23

    (@nixxxon23)

    Thank you! You are awesome – works like a charm.
    But I ran into another issue. I also use “Date Time Picker Field
    By Carlos Moreira”. According to your desctipition it should be compatible.

    All fields but the date / time field are submitted.

    Any idea? I already tried to unmap / map the field again but no luck.
    The field is a simple “textfield”.

    Thank you very much again for your awesome plugin. Such a time saver!

    BR;
    Niko

    Thread Starter NixXxon23

    (@nixxxon23)

    Thanks for the fast reply.
    Yes, it is linked to a custom post type named “gast”. The submission works fine but it looks like the hook doesn’t work.

    I actually just need 1 field prefilled with the id of the current post.

    BR,
    Niko

    Thread Starter NixXxon23

    (@nixxxon23)

    … OK good start. ??

    Did you try with my Code.
    1. You need to make sure that the user language is stored. You can do this with this function (This function stores the user language in the meta key “icl_admin_language” when a users signs up to your page). You can change “de” to “es” if “es” is your default language.:

    add_action( 'user_register', 'biog_registration_save', 20, 1 );
    
    function biog_registration_save( $user_id ) {
    	$lang = ICL_LANGUAGE_CODE;
        if ( isset( $lang ) )
            add_user_meta($user_id, 'icl_admin_language', $lang );
    	else
    		add_user_meta($user_id, 'icl_admin_language', 'de' );
    
    }

    Then comes the dirty code. You need to edit the plugin file (make sure to make a backup of the file before and after). This file will probably replaced if you make an plugin update so you need replace this file with your edited version after every plugin update until the author adds this change to his code.

    File: …/wp-content/plugins/user-registration/includes/class-ur-mailer.php

    public static function lost_password_email( $user_login, $user_data, $key ) {
    
    		$user     = get_user_by( 'login', $user_login );
    		$email    = isset( $user->data->user_email ) ? $user->data->user_email : '';
    		$username = isset( $user->data->user_login ) ? $user->data->user_login : '';
    
    		if ( empty( $email ) || empty( $username ) ) {
    			return false;
    		}
    		do_action('wpml_switch_language_for_email', $email); //todo check if funcion exists
    
    		$subject = get_option( 'user_registration_reset_password_email_subject', __( 'Password Reset Email: {{blog_info}}', 'user-registration' ) );
    		$message = new UR_Settings_Reset_Password_Email();
    		$message = $message->ur_get_reset_password_email();
    		$message = get_option( 'user_registration_reset_password_email', $message );
    
    		$values = array(
    			'username' => $username,
    			'email'    => $email,
    			'key'      => $key,
    		);
    
    		$message = self::parse_smart_tags( $message, $values );
    		$subject = self::parse_smart_tags( $subject, $values );
    
    		if ( 'yes' === get_option( 'user_registration_enable_reset_password_email', 'yes' ) ) {
    			
    			wp_mail( $email, $subject, $message, self::ur_get_header() );
    			do_action('wpml_switch_language_for_email', $email); //todo check if funcion exists
    			return true;
    		}
    
    		return false;
    	}

    The lost password mail is just an example. You need to add these 2 lines (see above and below example) for every mail you want to translate.

    • do_action(‘wpml_switch_language_for_email’, $email); –> add this before the $subject to switch the languague to the users language
    • do_action(‘wpml_switch_language_for_email’, $email); –> add this after wp_mail( $email,… to change the language back to default language
    • After this is done you can translate the strings in WPML and everything should work as expected. But only for newly registred users because “old” users do not have the meta key “icl_admin_language” set yet.

      Hope this helps. Hope you understand that I can’t support much further here because thats not my plugin and I do not eary anything but Karma for this ??

      BR,
      Niko

    • This reply was modified 4 years, 6 months ago by NixXxon23.
    • This reply was modified 4 years, 6 months ago by NixXxon23. Reason: formatting
    • This reply was modified 4 years, 6 months ago by NixXxon23.
    Thread Starter NixXxon23

    (@nixxxon23)

    Hi,
    do you use WPML?
    I’m not sure if the plugin uses “user_registration_get_email_confirmation”? Maybe the plugin author can help.

    My workaround solution is really just for users with WPML installed.

    Do you need your text JUST in spanish or in 2 different languages? If you just need it in Spanish you can edit the mailtest in the Plugin Settings ??

    BR,
    Niko

    Thread Starter NixXxon23

    (@nixxxon23)

    I did it. It would be great if you could add this in one of your future updates.
    First of all the users needs the meta key icl_admin_language.

    So I added this code to my functions.php

    
    add_action( 'user_register', 'biog_registration_save', 20, 1 );
    
    function biog_registration_save( $user_id ) {
    	$lang = ICL_LANGUAGE_CODE;
        if ( isset( $lang ) )
            add_user_meta($user_id, 'icl_admin_language', $lang );
    	else
    		add_user_meta($user_id, 'icl_admin_language', 'de' );
    
    }
    

    Then I edited your file: class-ur-mailer.php

    
    public static function lost_password_email( $user_login, $user_data, $key ) {
    
    		$user     = get_user_by( 'login', $user_login );
    		$email    = isset( $user->data->user_email ) ? $user->data->user_email : '';
    		$username = isset( $user->data->user_login ) ? $user->data->user_login : '';
    
    		if ( empty( $email ) || empty( $username ) ) {
    			return false;
    		}
    		do_action('wpml_switch_language_for_email', $email); //todo check if funcion exists
    
    		$subject = get_option( 'user_registration_reset_password_email_subject', __( 'Password Reset Email: {{blog_info}}', 'user-registration' ) );
    		$message = new UR_Settings_Reset_Password_Email();
    		$message = $message->ur_get_reset_password_email();
    		$message = get_option( 'user_registration_reset_password_email', $message );
    
    		$values = array(
    			'username' => $username,
    			'email'    => $email,
    			'key'      => $key,
    		);
    
    		$message = self::parse_smart_tags( $message, $values );
    		$subject = self::parse_smart_tags( $subject, $values );
    
    		if ( 'yes' === get_option( 'user_registration_enable_reset_password_email', 'yes' ) ) {
    			
    			wp_mail( $email, $subject, $message, self::ur_get_header() );
    			do_action('wpml_switch_language_for_email', $email); //todo check if funcion exists
    			return true;
    		}
    
    		return false;
    	}
    

    I added just 2 lines
    1st one before the email is send:
    do_action(‘wpml_switch_language_for_email’, $email);
    2nd after the mail is sent to switch the language back
    do_action(‘wpml_switch_language_for_email’, $email);

    Of course I did this for all mails. This is just an example.

    This will only work for users who have WPML installed!

    Would be great if you could notify me if you add this to one of your future updates.

    BR;
    Niko

    • This reply was modified 4 years, 7 months ago by NixXxon23.
    Thread Starter NixXxon23

    (@nixxxon23)

    I did a bit more testing and found out that the translation per se works BUT it uses the “admin language” and not the users language. It ignores “icl_admin_language”.

    https://prnt.sc/s4o1qq –> User would receive an german mail.

    If you could give me an code example how to hook in your mails and implement it with WPML it would be great.
    https://wpml.org/documentation/support/sending-emails-with-wpml/

    I just need need one example and can do the rest of the mails by myself.

    Thread Starter NixXxon23

    (@nixxxon23)

    Hello,
    thanks for the fast reply. For me it doesn’t work out of the box.
    Maybe because I set a custom message in your plugins settings? I don’t know how to reset this to default without deleting the plugin…

    I translated the desired string in WPML and tested with a user who’s language is set to English but I still receive the german mailtext which I set in the settings.

    Thank you for your support!

    Best,
    Niko

    Thread Starter NixXxon23

    (@nixxxon23)

    p.S.: It also happens with default twenty seventeen theme!
    Cataloque mode is disabled.

    BR,
    Niko

    Thread Starter NixXxon23

    (@nixxxon23)

    … Thank you for your answer. But could you maybe give me a hint in which file I have to look for the function of the button?

    I think it would be MUCH more end-user-friendly when they do not need to refresh the page to add different variations to the quote.

    Thread Starter NixXxon23

    (@nixxxon23)

    Already resolved. I do not know what actually caused the failure but the issue was that the mentioned error notice was inserted in the translation fields in the backend and therefore showed up on the frontpage instead of the word ?Download“.

    Thanks for your reply and the great plugin!

    Best,
    Niko

    Well I don’t have a multisite setup for this project but still got this (unreproduceable) error.
    Yesterday night I replaced the membership2 login with the plugin “Login With Ajax” so far it works good but I kinda have the feeling that didn’t solve the actual problem.

    But I also cross the fingers that your new setup will solve the problem for you!

Viewing 15 replies - 1 through 15 (of 32 total)