• Hello all,

    i really enjoy using your plugin but i ran into a major issue.
    When i register a new user in the backend he gets the activation mail and also the welcome mail with the username, password and login page.
    But when i try to import users via WP All Import, the users do not get any e-mail at all.
    Although elementor is set so that new users with the role get both emails. Are there any hooks I can address via custom code to send these mails?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @1jd123

    I suggest you contact WP All Import support as we are not sure if import triggers actions related to user registration or not.

    Thread Starter 1jd123

    (@1jd123)

    Dear Aswin,

    I have had contact with the WP All Import Support and they mentioned this
    https://docs.ultimatemember.com/
    1. WP All import allows php custom code for every imported user. Is there any way to grab some UM Hooks to send the activation and welcome mail? This is really important for me.

    2. When a user does his registration in the frontend of our website he will receive a welcome mail which is specific to frontend registration. Is there any way to send another welcome mail to someone who is imported in the backend? The imported users do need the password reset link.

    BEst

    Jannis

    missveronica

    (@missveronicatv)

    @1jd123

    You can create a custom email template for the imported users
    and add the set password placeholder.

    Read these guides:

    How to add and use custom email templates

    https://docs.ultimatemember.com/article/1515-how-to-add-and-use-custom-email-templates

    Set Password on Email Activation

    https://docs.ultimatemember.com/article/1693-set-password-on-email-activation

    • This reply was modified 3 weeks, 2 days ago by missveronica.
    Thread Starter 1jd123

    (@1jd123)

    Hello Missveronica,

    I am already using these two functions but these aren’t the issue.
    The issue is, that the imported users dont get an activation e-mail after they were imported. So what I need is a hook or like custom code which automatically sent the activation mail after a user was imported. After the user then activated his account, the user should get a mail with his access data including the set password link. The issue here is, that the imported user does have the same role as the frontend user so how can I sent the imported user a different mail as the frontend user?

    Thanks in advance.

    Best,

    Jannis

    Thread Starter 1jd123

    (@1jd123)

    So to be more specific I need the following:
    1. I need a hook to send the activation e-mail to a user.
    2. I need a way to write a different welcome email to imported users after activation, even though they are in the same role as non-imported users.

    missveronica

    (@missveronicatv)

    @1jd123

    1. I need a hook to send the activation e-mail to a user.

    Yes you need a hook in the import plugin when a user has been added.

    The import plugin is active during this user load and you must invite UM to send the email by calling:

    UM()->mail()->send( $email, $template, $args );

    Ask the import plugin support if there is a hook you can use.

    Thread Starter 1jd123

    (@1jd123)

    Hello Missveronica,

    thank you so much for getting back to me this quick.
    I already asked the plugin team und they mentioned this:

    add_action( 'pmxi_saved_post', 'my_custom_function', 10, 3 );

    Since I am not that experienced in programming php is it correct if my function will look like this, where email is a variable and $template can be replaced by the name of $template like (group1_approved_email):

    my_custom_function($email){
    UM()->mail()->send( $email, $template, $args );
    }

    Thank you soooo much in advance for your help. You are awesome

    missveronica

    (@missveronicatv)

    @1jd123

    Can you try to get the documentation for the hook including the three parameters.

    Thread Starter 1jd123

    (@1jd123)

    Dear Missveronica,

    Here is the documentation: https://www.wpallimport.com/documentation/action-reference/

    Best,

    Jannis

    Thread Starter 1jd123

    (@1jd123)

    https://www.wpallimport.com/documentation/code-snippets/Here is another sample, the first one.

    missveronica

    (@missveronicatv)

    @1jd123

    You can try this code snippet.

    Two templates one for approval of a new user account,
    the second if updating an existing user account.

    add_action( 'pmxi_saved_post', 'pmxi_saved_post_um_custom_function', 10, 3 );
    
    function pmxi_saved_post_um_custom_function( $user_id, $xml_node, $is_update ) {
    
        if ( ! class_exists( 'UM' ) ) return;
        um_fetch_user( $user_id );
    
        if( ! $is_update ) {
            UM()->mail()->send( um_user( 'user_email' ), 'group1_approved_email' );
        } else {
            UM()->mail()->send( um_user( 'user_email' ), 'group1_updated_email' );
        }
    }
    Thread Starter 1jd123

    (@1jd123)

    Jello Missveronica,

    thank you so much! Now I am able to get mails but neither the account activation link nor the password reset link is generated.

    Best,

    Jannis

    missveronica

    (@missveronicatv)

    @1jd123

    An updated code snippet now with these placeholders:
    {account_activation_link}, {password_reset_link}, {set_password_link}

    https://docs.ultimatemember.com/article/1693-set-password-on-email-activation

    add_action( 'pmxi_saved_post', 'pmxi_saved_post_um_custom_function', 10, 3 );
    
    function pmxi_saved_post_um_custom_function( $user_id, $xml_node, $is_update ) {
    
        if ( ! class_exists( 'UM' )) return;
        if ( ! is_numeric( $user_id )) return;
        
        um_fetch_user( $user_id );
    
        $user_data = get_userdata( $user_id );
        $key       = UM()->user()->maybe_generate_password_reset_key( $user_data );
    
        $set_password_link = add_query_arg( array(  'set_pass' => 'new_user', 
                                                    'act'      => 'reset_password', 
                                                    'hash'     => $key, 
                                                    'user_id'  => $user_id ), um_get_core_page( 'password-reset' ) );
        
        $args['tags'] = array(  '{account_activation_link}', 
                                '{password_reset_link}', 
                                '{set_password_link}' );
    
        $args['tags_replace'] = array(  um_user( 'account_activation_link' ), 
                                        um_user( 'password_reset_link' ),
                                        $set_password_link,
                                    );
        if( ! $is_update ) {
            UM()->mail()->send( um_user( 'user_email' ), 'group1_approved_email', $args );
        } else {
            UM()->mail()->send( um_user( 'user_email' ), 'group1_updated_email', $args );
        }
    }
Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.