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.
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
@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.
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
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 );
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?
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.
Hello @frontendhomie
Are you able to post the url which you receive in the email to the password set page?
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
@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?
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