by axew3 » Fri May 31, 2019 10:53 pm
OBSOLETE, read this topic instead:
viewtopic.php?t=1864
For a more clear topic about this, same post/answer into another older topic copied here.
Please follow here if necessary.
So, about the Ultimate Member password problem:
All work fine, into wp_admin side, so when an user update his profile into native
/wp-admin/profile.php page
or an admin update an user via wp_admin page.
Pass update do not work into the frontend Ultimate Member profile page, when the user update his profile via UM pages because in this case, the Ultimate member do not fire the native
profile_update wp hook.
On UM profile updates, when pass changes, it just do this on file /ultimate-member/includes/core/um-actions-account.php
[code] wp_set_password( $changes['user_pass'], um_user( 'ID' ) );[/code]
So i've try to use native UM hooks, as they are documented on code files, and of course i resolved the problem but, i had to add a function into the integration plugin, an hook, and edit another integration plugin function: UM in this case work fine but, throw/return an error to the user profile, and say Error Occurred on updating to the user, even if the password correctly changed/updated. To suppress the UM "An error occurs on update" notice, was necessary more code.
To not investigate more looking how UM throw errors, suppressing the js that fire the notice to the user on profile, and to be more short,
to fix i've try do this:
FIX Ultimate Member pass update/change on UM user's profile page:
since wp_set_password use/fire wp_hash_password we could do this then ...
open wp_w3all.php file and
where this code:
[code]
if ( ! function_exists( 'wp_hash_password' ) && ! defined("WPW3ALL_NOT_ULINKED") ) :
function wp_hash_password( $password ) {
$pass = WP_w3all_phpbb::phpBB_password_hash($password);
return $pass;
}
endif;[/code]
change/replace with this:
[code]if ( ! function_exists( 'wp_hash_password' ) && ! defined("WPW3ALL_NOT_ULINKED") ) :
function wp_hash_password( $password ) {
$pass = WP_w3all_phpbb::phpBB_password_hash($password);
if ( ! defined( 'WP_ADMIN' ) && class_exists( 'UM' ) ) {
global $w3all_config,$wpdb;
$w3phpbb_conn = WP_w3all_phpbb::wp_w3all_phpbb_conn_init();
$current_user = wp_get_current_user();
$wp_user_data = get_user_by( 'ID', $current_user->ID );
$phpBB_user_pass_set = WP_w3all_phpbb::phpbb_pass_update_res($wp_user_data, $pass);
$w3phpbb_conn->query("UPDATE ".$w3all_config["table_prefix"]."users SET user_password = '$pass' WHERE username = '".$current_user->user_login."'");
}
return $pass;
}
endif;
[/code]
Should work fine.
It's strange that email is not a problem, it's correctly updated, while the password not on UM frontend profile page. I've not follow all the code flow, just find out a way to resolve in short and within integration plugin. Let know if further problems with ultimate member plugin.
Someone asked time ago to integrate also UM avatar like for buddypress.
[size=200]OBSOLETE, read this topic instead:[/size]
[size=150][url]https://www.axew3.com/w3/forums/viewtopic.php?t=1864[/url][/size]
[strike]For a more clear topic about this, same post/answer into another older topic copied here.
Please follow here if necessary.
So, about the Ultimate Member password problem:
All work fine, into wp_admin side, so when an user update his profile into native
[i]/wp-admin/profile.php[/i] page
or an admin update an user via wp_admin page.
Pass update do not work into the frontend Ultimate Member profile page, when the user update his profile via UM pages because in this case, the Ultimate member [b]do not fire[/b] the native
[b]profile_update[/b] wp hook.
On UM profile updates, when pass changes, it just do this on file /ultimate-member/includes/core/[i]um-actions-account.php[/i]
[code] wp_set_password( $changes['user_pass'], um_user( 'ID' ) );[/code]
So i've try to use native UM hooks, as they are documented on code files, and of course i resolved the problem but, i had to add a function into the integration plugin, an hook, and edit another integration plugin function: UM in this case work fine but, throw/return an error to the user profile, and say Error Occurred on updating to the user, even if the password correctly changed/updated. To suppress the UM "An error occurs on update" notice, was necessary more code.
To not investigate more looking how UM throw errors, suppressing the js that fire the notice to the user on profile, and to be more short,
to fix i've try do this:
[size=150][b]
FIX Ultimate Member pass update/change on UM user's profile page:[/b][/size]
since [i]wp_set_password[/i] use/fire [i]wp_hash_password[/i] we could do this then ...
[b]open [i]wp_w3all.php[/i] file and[/b]
where this code:
[code]
if ( ! function_exists( 'wp_hash_password' ) && ! defined("WPW3ALL_NOT_ULINKED") ) :
function wp_hash_password( $password ) {
$pass = WP_w3all_phpbb::phpBB_password_hash($password);
return $pass;
}
endif;[/code]
[b]change/replace with this:[/b]
[code]if ( ! function_exists( 'wp_hash_password' ) && ! defined("WPW3ALL_NOT_ULINKED") ) :
function wp_hash_password( $password ) {
$pass = WP_w3all_phpbb::phpBB_password_hash($password);
if ( ! defined( 'WP_ADMIN' ) && class_exists( 'UM' ) ) {
global $w3all_config,$wpdb;
$w3phpbb_conn = WP_w3all_phpbb::wp_w3all_phpbb_conn_init();
$current_user = wp_get_current_user();
$wp_user_data = get_user_by( 'ID', $current_user->ID );
$phpBB_user_pass_set = WP_w3all_phpbb::phpbb_pass_update_res($wp_user_data, $pass);
$w3phpbb_conn->query("UPDATE ".$w3all_config["table_prefix"]."users SET user_password = '$pass' WHERE username = '".$current_user->user_login."'");
}
return $pass;
}
endif;
[/code]
Should work fine.
It's strange that email is not a problem, it's correctly updated, while the password not on UM frontend profile page. I've not follow all the code flow, just find out a way to resolve in short and within integration plugin. Let know if further problems with ultimate member plugin.
Someone asked time ago to integrate also UM avatar like for buddypress.[/strike]