Merge pull request #1728 from ultimatemember/fix/edit_user_link

Edit user link
This commit is contained in:
Mykyta Synelnikov
2025-09-05 11:58:49 +03:00
committed by GitHub
+12
View File
@@ -19,6 +19,8 @@ if ( ! class_exists( 'um\frontend\User_Profile' ) ) {
*/
public function __construct() {
add_action( 'template_redirect', array( $this, 'handle_edit_screen' ), 10000 );
add_filter( 'get_edit_user_link', array( $this, 'get_um_edit_user_link' ), 10, 2 );
add_filter('get_comment_author_url', array( $this, 'get_comment_author_url' ), 10, 3);
}
/**
@@ -30,6 +32,7 @@ if ( ! class_exists( 'um\frontend\User_Profile' ) ) {
return;
}
// phpcs:disable WordPress.Security.NonceVerification
if ( ! isset( $_REQUEST['um_action'] ) ) {
return;
}
@@ -44,6 +47,7 @@ if ( ! class_exists( 'um\frontend\User_Profile' ) ) {
if ( isset( $_REQUEST['uid'] ) ) {
$uid = absint( $_REQUEST['uid'] );
}
// phpcs:enable WordPress.Security.NonceVerification
if ( ! empty( $uid ) && ! UM()->common()->users()::user_exists( $uid ) ) {
return;
@@ -65,5 +69,13 @@ if ( ! class_exists( 'um\frontend\User_Profile' ) ) {
exit;
}
}
public function get_um_edit_user_link( $link, $user_id ) {
return um_edit_profile_url( $user_id );
}
public function get_comment_author_url( $comment_author_url, $comment_id, $comment ) {
return um_user_profile_url( $comment->user_id );
}
}
}