• michael_feh

    (@frontendhomie)


    Hey there,
    I’m trying to build a client portal for my clients. Since the userbase is already in another database i will import the users via CSV (wp all import). As soon as I import the users, they should get an e-mail with a welcome message and a link to the form where they can set their password.

    After some research i found these two articles:
    1. https://docs.ultimatemember.com/article/1652-how-to-enable-email-notification-on-activation-or-admin-review-upon-users-registration
    2. https://docs.ultimatemember.com/article/1693-set-password-on-um-email-templates
    I followed through with the instructions but noticed that the e-mail doesnt contain a link to set the password when i put “{set_password_link}” as href.

    A second glaned i notices that the second article start with “This plugin simplifies the password setup process”. So i guess I need to install this plugin first to get this working.

    So I guess my questions are:
    A. Do i really need this plugin to get the desired outcome (Welcome Mail with Set Password Link)? Or is there another way to achieve this?
    B. What do i need to do to install the plugin? Where can I download it?
    C. Is this plugin an “extension” for which i need an Extensions Pass? or can I purchase this extension by itself somehow?

    Thanks in advance,
    Michael

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

    (@aswingiri)

    Hello @frontendhomie

    If you want to send {set_password_link} in email, you will need this plugin. This is a free plugin and it includes a collection of small features for the UM plugin. You can get the plugin here.

    Thread Starter michael_feh

    (@frontendhomie)

    Thanks for the quick response.

    I downloaded and installed the Extend-main plugin.
    I activated the part “set password for email” part.
    Unfortunatelly it didnt have any effect: the {set_password_link} didnt output the desired link in the mail… this link in the mail after import was:
    “x-webdoc://A702DF8B-5471-4C95-9260-2490252761A3/%7Bset_password_link%7D”

    So i checked the plugin settings again and clicked on the “enable all active” switch. since then i cannot enter the frontend or admin backend of the site but get the erro message:
    “Invalid Class Name: UM_Extended_Set_Password\Core”

    Any idea of whats going?
    Thanks in adance,
    Michael

    Plugin Support Aswin Giri

    (@aswingiri)

    @frontendhomie

    If you are having an issue with the plugin, can you please try this code snippet instead? You can directly paste this code in your theme’s functions.php or use the “Code Snippets” plugin to add this to your site.

    • This reply was modified 1 year ago by Aswin Giri.
    Thread Starter michael_feh

    (@frontendhomie)

    Thanks for response and sharing the snippet.

    I deleted the plugin.
    When i put the code in the theme’s function i get a critical error in /wp-admin “There was a critical error on your website.”

    I tried deactivating all other plugins and im running a standard theme “Twenty Twenty-Three”. PHP is 8.2.

    Any idea of whats going?
    Thanks in adance,
    Michael

    Thread Starter michael_feh

    (@frontendhomie)

    I checked the debug.log. There was a syntax error in the php.

    Now the code works. At least there is a password reset link in the mail.
    Unfortunatelly the link links to a page that says “The link to reset the password seems to be invalid. Please request a new link below.”

    Any ideas of how to tackle this?

    Here is the fixed function code:

    <?php
    // Add a new placeholder for set password link
    add_filter( 'um_template_tags_patterns_hook', function( $placeholders ) {
    $placeholders[] = '{set_password_link}';
    return $placeholders;
    }, 10, 1 );
    
    // Replace the placeholder with the actual set password link
    add_filter( 'um_template_tags_replaces_hook', function( $replace_placeholders ) {
    $last_user_id = 0;
    $user_id = um_user( 'ID' );
    if ( $last_user_id !== $user_id ) {
    $last_user_id = $user_id;
    }
    $url = UM()->password()->reset_url();
    $replace_placeholders[] = add_query_arg( array( 'set_pass' => 'new_user' ), $url );
    return $replace_placeholders;
    }, 10, 1 );
    
    // Modify texts on the password reset page
    add_action( 'template_redirect', function() {
    if ( ! isset( $_REQUEST['set_pass'] ) ) {
    return;
    }
    
    add_filter(
        'um_edit_label_user_password',
        function( $text ) {
            return __( 'Set your Password', 'um-extended' );
        }
    );
    
    add_filter(
        'gettext',
        function ( $translated_text, $untranslated_text, $domain ) {
            if ( 'Change my password' === $translated_text ) {
                return __( 'Save my password', 'um-extended' );
            }
            return $translated_text;
        },
        10,
        3
    );
    
    });
    
    // Actions after password change
    add_action( 'um_after_changing_user_password', function( $user_id ) {
    if ( isset( $_REQUEST['set_pass'] ) && 'new_user' === sanitize_key( $_REQUEST['set_pass'] ) ) {
    um_fetch_user( $user_id );
    UM()->user()->approve( false );
    }
    wp_safe_redirect( um_get_core_page( 'login', 'password_set' ) );
    exit;
    });
    
    // Define the custom success message handler
    function change_password_set_message( $success, $key ) {
    if ( 'password_set' === $key ) {
    $success = __( 'Your password has been set. Please login below.', 'um-extended' );
    }
    return $success;
    }
    
    // Add the custom success message handler
    add_filter( 'um_custom_success_message_handler', 'change_password_set_message', 10, 2 );

    Thread Starter michael_feh

    (@frontendhomie)

    one last info: i noticed UM is not tested with wordpress 6.4.2
    but i am runnung the latest version of wordpress.
    might this be an issue?

    missveronica

    (@missveronicatv)

    Thread Starter michael_feh

    (@frontendhomie)

    I now updated to UM 2.8.0.

    Unfortunatelly the issues still persist:
    1. When I activate the “Extend-main” plugin i get a critical error “Invalid Class Name: UM_Extended_Set_Password\Core”
    2. When I use the provided snippet code to set password in activiation mail, it says “The link to reset the password seems to be invalid. Please request a new link below.” on the password set page.

    Plugin Support Aswin Giri

    (@aswingiri)

    Hello @frontendhomie

    Are you able to post the url which you receive in the email to the password set page?

    Thread Starter michael_feh

    (@frontendhomie)

    holdusback

    (@holdusback)

    I was checking issue with UM2.8 and came to this topic.

    I do exactly what u want to do :
    Import users, send email with a button for them to setup a password.

    I do this with multiple plugins & code customization (you need to know how to dev in PHP)
    I do it with :
    UM -> Role Restriction only, not rly needed.
    Personalize Login -> Personalize all login/password form, I customized everything for my need.
    https://fr.wordpress.org/plugins/personalize-login/
    Import users and customers from CSV -> Import CSV weekly with new users & send a customization email with a button to the reset pass form.

    So, no you dont rly need Ultimate Members to do that.

    Hope it helped

    Thread Starter michael_feh

    (@frontendhomie)

    @holdusback thx for the info, seems like a big workaround wir a lot of cutsom coding. i’d rather use a renown plugin like um for this case.

    @aswingiri any idea of whats going on with the url?

    Thread Starter michael_feh

    (@frontendhomie)

    update:
    the plugin got fixed.
    https://github.com/ultimatemember/Extended/releases
    i now have the plugin um-set-password.zip installed.

    I’m still having the same issue though: the link {set_password_link} generates leads to a set password form that says “The link to reset the password seems to be invalid. Please request a new link below.”

    Link URL looks like this:
    http://mysite.com/password-reset/?act=reset_password&hash=JUnB7LMsEGzz4R48IePM&login=my.name%40gmail.com&set_pass=new_user

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Welcome Mail with Set Password Link / extension needed?’ is closed to new replies.