- fixed user permalinks for profile page;

This commit is contained in:
nikitozzzzzzz
2018-03-07 10:58:58 +02:00
parent 3ba053dc16
commit 179fc36ebf
4 changed files with 23 additions and 8 deletions
+2 -1
View File
@@ -118,7 +118,8 @@ if ( ! class_exists( 'Admin_Users' ) ) {
function user_row_actions( $actions, $user_object ) {
$user_id = $user_object->ID;
$actions['frontend_profile'] = "<a class='' href='" . UM()->user()->get_profile_link( $user_id ) . "'>" . __( 'View profile', 'ultimate-member' ) . "</a>";
$actions['frontend_profile'] = "<a class='' href='" . um_user_profile_url( $user_id ) . "'>" . __( 'View profile', 'ultimate-member' ) . "</a>";
$submitted = get_user_meta( $user_id, 'submitted', true );
if ( ! empty( $submitted ) )
+3 -3
View File
@@ -229,12 +229,12 @@ if ( ! class_exists( 'Rewrite' ) ) {
$query = UM()->permalinks()->get_query_array();
$url = um_user_profile_url();
if ( empty( $url ) ) {
$url = um_user_profile_url( um_user( 'ID' ) );
/*if ( empty( $url ) ) {
//if empty profile slug - generate it and re-get profile URL
UM()->user()->generate_profile_slug( um_user( 'ID' ) );
$url = um_user_profile_url();
}
}*/
if ( $query ) {
foreach ( $query as $key => $val ) {
+2 -1
View File
@@ -456,7 +456,8 @@ if ( ! defined( 'ABSPATH' ) ) exit;
do_action( 'um_update_profile_full_name', um_user( 'ID' ), $to_update );
if ( ! isset( $args['is_signup'] ) ) {
$url = UM()->user()->get_profile_link( um_user( 'ID' ) );
$url = um_user_profile_url( um_user( 'ID' ) );
exit( wp_redirect( um_edit_my_profile_cancel_uri( $url ) ) );
}
+16 -3
View File
@@ -1399,10 +1399,23 @@ function um_admin_email() {
/**
* Display a link to profile page
*
* @return string
* @param int|bool $user_id
*
* @return bool|string
*/
function um_user_profile_url() {
return UM()->user()->get_profile_link( um_user( 'ID' ) );
function um_user_profile_url( $user_id = false ) {
if ( ! $user_id ) {
$user_id = um_user( 'ID' );
}
$url = UM()->user()->get_profile_link( $user_id );
if ( empty( $url ) ) {
//if empty profile slug - generate it and re-get profile URL
UM()->user()->generate_profile_slug( $user_id );
$url = UM()->user()->get_profile_link( $user_id );
}
return $url;
}