Define user email for new imported users

Hello,
I just bought Import/Export extension, so I am new to Import/Export Groups. I need help in creating the mail which is sent to new imported users.
I found the API with the filters
‘groups_import_export_new_user_registration_subject’ and ‘groups_import_export_new_user_registration_message’

Is there an example to find, how to add the filters to my functions.php in my child theme?
Or can somebody help with a code snippet?

I also found the file “class-groups-user-import.php” where the function “new_user_notification” can be found in line 581.
I can change the text there, but that seems not to be the best way because it will be overwritten by the next update.

Thanks a lot for your help and take care in this pandemic times!
Henner

2 Responses to Define user email for new imported users

  1. Henner Ungethuem July 12, 2021 at 12:56 pm #

    Thanks Eugen,
    I will give it a try. I am not a php coder, so my thinking about the message filter results in this:

    add_filter( ‘groups_import_export_new_user_registration_message’, ‘groups_import_export_new_user_registration_message_handler’, 10, 3 );
    function groups_import_export_new_user_registration_message_handler( $message, $user_id, $plaintext_pass ) {
    // Modify the Message; for example
    $message = “FooBar”;

    // return the message
    return $message;
    }

    I will try getting the message like this:
    $message=”Hello [firstname] [lastname], here is your account username and passwort:”
    $message=$message & “Your username is: ” & [username]” & newline
    $message=$message & “Your Password is: ” & $plaintext_pass & newline
    $message=$message & “Please login on our website: mydomain.de/loginpage”

    Thanks and stay safe
    Henner

  2. Eugen Bleck July 12, 2021 at 12:20 pm #

    Hello Henner,

    Good morning and happy new week!

    Many thanks for choosing and using Groups Import Export. It brings us great joy to know you are using our plugin.

    Here’s the signature for using a filter in your functions.php file within the child theme:

    add_filter( ‘groups_import_export_new_user_registration_subject’, ‘groups_import_export_new_user_registration_subject_handler’, 10, 3 );
    function groups_import_export_new_user_registration_subject_handler( $subject, $user_id, $plaintext_pass ) {
    // Modify the Subject; for example
    $subject = “FooBar”;

    // return the subject
    return $subject;
    }

    You would then do the same for the message filter. You can read more on this here:
    https://docs.itthinx.com/document/groups-import-export/api/

    STAY SAFE and I wish you a very peaceful and productive week.
    Best,
    Eugen.

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share