mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Merge pull request #1299 from ultimatemember/feature/hash_slug
Hash slug for user Profile link
This commit is contained in:
@@ -7,41 +7,34 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
||||
if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Class Admin_Settings
|
||||
* @package um\admin\core
|
||||
*/
|
||||
class Admin_Settings {
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $settings_map;
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $settings_structure;
|
||||
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
private $previous_licenses;
|
||||
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
private $need_change_permalinks;
|
||||
|
||||
|
||||
private $gravatar_changed = false;
|
||||
|
||||
|
||||
/**
|
||||
* Admin_Settings constructor.
|
||||
*/
|
||||
@@ -668,6 +661,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
'permalink_base' => array(
|
||||
'sanitize' => 'key',
|
||||
),
|
||||
'permalink_base_custom_meta' => array(
|
||||
'sanitize' => 'text',
|
||||
),
|
||||
'display_name' => array(
|
||||
'sanitize' => 'key',
|
||||
),
|
||||
@@ -1014,14 +1010,24 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
// translators: %s: Profile page URL
|
||||
'tooltip' => sprintf( __( 'Here you can control the permalink structure of the user profile URL globally e.g. %s<strong>username</strong>/', 'ultimate-member' ), trailingslashit( um_get_core_page( 'user' ) ) ),
|
||||
'options' => array(
|
||||
'user_login' => __( 'Username', 'ultimate-member' ),
|
||||
'name' => __( 'First and Last Name with \'.\'', 'ultimate-member' ),
|
||||
'name_dash' => __( 'First and Last Name with \'-\'', 'ultimate-member' ),
|
||||
'name_plus' => __( 'First and Last Name with \'+\'', 'ultimate-member' ),
|
||||
'user_id' => __( 'User ID', 'ultimate-member' ),
|
||||
'user_login' => __( 'Username', 'ultimate-member' ),
|
||||
'name' => __( 'First and Last Name with \'.\'', 'ultimate-member' ),
|
||||
'name_dash' => __( 'First and Last Name with \'-\'', 'ultimate-member' ),
|
||||
'name_plus' => __( 'First and Last Name with \'+\'', 'ultimate-member' ),
|
||||
'user_id' => __( 'User ID', 'ultimate-member' ),
|
||||
'hash' => __( 'Unique hash string', 'ultimate-member' ),
|
||||
'custom_meta' => __( 'Custom usermeta', 'ultimate-member' ),
|
||||
),
|
||||
'placeholder' => __( 'Select...', 'ultimate-member' ),
|
||||
),
|
||||
array(
|
||||
'id' => 'permalink_base_custom_meta',
|
||||
'type' => 'text',
|
||||
'label' => __( 'Profile Permalink Base Custom Meta Key', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Specify the custom field meta key that you want to use as profile permalink base. Meta value should be unique.', 'ultimate-member' ),
|
||||
'conditional' => array( 'permalink_base', '=', 'custom_meta' ),
|
||||
'size' => 'medium',
|
||||
),
|
||||
array(
|
||||
'id' => 'display_name',
|
||||
'type' => 'select',
|
||||
@@ -1047,6 +1053,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
'label' => __( 'Display Name Custom Field(s)', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Specify the custom field meta key or custom fields seperated by comma that you want to use to display users name on the frontend of your site', 'ultimate-member' ),
|
||||
'conditional' => array( 'display_name', '=', 'field' ),
|
||||
'size' => 'medium',
|
||||
),
|
||||
array(
|
||||
'id' => 'author_redirect',
|
||||
@@ -2439,9 +2446,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
|
||||
} elseif ( ! empty( $_POST['um_options']['permalink_base'] ) ) {
|
||||
if ( ! empty( $this->need_change_permalinks ) ) {
|
||||
$users = get_users( array(
|
||||
'fields' => 'ids',
|
||||
) );
|
||||
$users = get_users(
|
||||
array(
|
||||
'fields' => 'ids',
|
||||
)
|
||||
);
|
||||
if ( ! empty( $users ) ) {
|
||||
foreach ( $users as $user_id ) {
|
||||
UM()->user()->generate_profile_slug( $user_id );
|
||||
@@ -3701,12 +3710,12 @@ Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ?
|
||||
*
|
||||
*/
|
||||
function um_download_install_info() {
|
||||
|
||||
|
||||
if ( ! empty( $_POST['download_install_info'] ) ) {
|
||||
$nonce = $_REQUEST['_wpnonce'];
|
||||
if ( ! wp_verify_nonce( $nonce, 'um_download_install_info' ) || ! current_user_can( 'manage_options' ) ) {
|
||||
die( __( 'Security check', 'ultimate-member' ) );
|
||||
}
|
||||
die( __( 'Security check', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
nocache_headers();
|
||||
|
||||
|
||||
@@ -511,6 +511,7 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'disable_restriction_pre_queries' => 0,
|
||||
'uninstall_on_delete' => 0,
|
||||
'permalink_base' => 'user_login',
|
||||
'permalink_base_custom_meta' => '',
|
||||
'display_name' => 'full_name',
|
||||
'display_name_field' => '',
|
||||
'author_redirect' => 1,
|
||||
|
||||
@@ -249,26 +249,42 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $slug
|
||||
* @param string $slug
|
||||
*
|
||||
* @return int|null|string
|
||||
* @return int|bool
|
||||
*/
|
||||
public function slug_exists_user_id( $slug ) {
|
||||
global $wpdb;
|
||||
|
||||
$permalink_base = UM()->options()->get( 'permalink_base' );
|
||||
if ( 'custom_meta' === $permalink_base ) {
|
||||
$custom_meta = UM()->options()->get( 'permalink_base_custom_meta' );
|
||||
if ( empty( $custom_meta ) ) {
|
||||
// Set default permalink base if custom meta is empty.
|
||||
$permalink_base = 'user_login';
|
||||
$meta_key = 'um_user_profile_url_slug_' . $permalink_base;
|
||||
} else {
|
||||
$meta_key = $custom_meta;
|
||||
}
|
||||
} else {
|
||||
$meta_key = 'um_user_profile_url_slug_' . $permalink_base;
|
||||
}
|
||||
|
||||
$user_id = $wpdb->get_var(
|
||||
"SELECT user_id
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE meta_key = 'um_user_profile_url_slug_{$permalink_base}' AND
|
||||
meta_value = '{$slug}'
|
||||
ORDER BY umeta_id ASC
|
||||
LIMIT 1"
|
||||
$wpdb->prepare(
|
||||
"SELECT user_id
|
||||
FROM {$wpdb->usermeta}
|
||||
WHERE meta_key = %s AND
|
||||
meta_value = %s
|
||||
ORDER BY umeta_id ASC
|
||||
LIMIT 1",
|
||||
$meta_key,
|
||||
$slug
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! empty( $user_id ) ) {
|
||||
return $user_id;
|
||||
return absint( $user_id );
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -374,9 +390,7 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
|
||||
|
||||
$user_in_url = '';
|
||||
|
||||
$full_name = str_replace( "'", "", $full_name );
|
||||
$full_name = str_replace( "&", "", $full_name );
|
||||
$full_name = str_replace( "/", "", $full_name );
|
||||
$full_name = str_replace( array( "'", '&', '/' ), '', $full_name );
|
||||
|
||||
switch ( $permalink_base ) {
|
||||
case 'name': // dotted
|
||||
|
||||
+96
-120
@@ -1,65 +1,59 @@
|
||||
<?php
|
||||
namespace um\core;
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Class Rewrite
|
||||
* @package um\core
|
||||
*/
|
||||
class Rewrite {
|
||||
|
||||
|
||||
/**
|
||||
* Rewrite constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
public function __construct() {
|
||||
if ( ! defined( 'DOING_AJAX' ) ) {
|
||||
add_action( 'wp_loaded', array( $this, 'maybe_flush_rewrite_rules' ) );
|
||||
}
|
||||
|
||||
//add rewrite rules
|
||||
add_filter( 'query_vars', array( &$this, 'query_vars' ), 10, 1 );
|
||||
add_filter( 'rewrite_rules_array', array( &$this, '_add_rewrite_rules' ), 10, 1 );
|
||||
add_filter( 'query_vars', array( &$this, 'query_vars' ) );
|
||||
add_filter( 'rewrite_rules_array', array( &$this, 'add_rewrite_rules' ) );
|
||||
|
||||
add_action( 'template_redirect', array( &$this, 'redirect_author_page' ), 9999 );
|
||||
add_action( 'template_redirect', array( &$this, 'locate_user_profile' ), 9999 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update "flush" option for reset rules on wp_loaded hook
|
||||
* Update "flush" option for reset rules on wp_loaded hook.
|
||||
*/
|
||||
function reset_rules() {
|
||||
public function reset_rules() {
|
||||
update_option( 'um_flush_rewrite_rules', 1 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset Rewrite rules if need it.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function maybe_flush_rewrite_rules() {
|
||||
public function maybe_flush_rewrite_rules() {
|
||||
if ( get_option( 'um_flush_rewrite_rules' ) ) {
|
||||
flush_rewrite_rules( false );
|
||||
delete_option( 'um_flush_rewrite_rules' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Modify global query vars
|
||||
* Modify global query vars.
|
||||
*
|
||||
* @param $public_query_vars
|
||||
* @param array $public_query_vars
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function query_vars( $public_query_vars ) {
|
||||
public function query_vars( $public_query_vars ) {
|
||||
$public_query_vars[] = 'um_user';
|
||||
$public_query_vars[] = 'um_tab';
|
||||
$public_query_vars[] = 'profiletab';
|
||||
@@ -74,15 +68,14 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
return $public_query_vars;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add UM rewrite rules
|
||||
* Add UM rewrite rules.
|
||||
*
|
||||
* @param $rules
|
||||
* @param array $rules
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function _add_rewrite_rules( $rules ) {
|
||||
public function add_rewrite_rules( $rules ) {
|
||||
$newrules = array();
|
||||
|
||||
$newrules['um-download/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?um_action=download&um_form=$matches[1]&um_field=$matches[2]&um_user=$matches[3]&um_verify=$matches[4]';
|
||||
@@ -90,11 +83,10 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
if ( isset( UM()->config()->permalinks['user'] ) ) {
|
||||
|
||||
$user_page_id = UM()->config()->permalinks['user'];
|
||||
$user = get_post( $user_page_id );
|
||||
$user = get_post( $user_page_id );
|
||||
|
||||
if ( isset( $user->post_name ) ) {
|
||||
|
||||
$user_slug = $user->post_name;
|
||||
$user_slug = $user->post_name;
|
||||
$newrules[ $user_slug . '/([^/]+)/?$' ] = 'index.php?page_id=' . $user_page_id . '&um_user=$matches[1]';
|
||||
}
|
||||
|
||||
@@ -104,12 +96,11 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
$active_languages = $sitepress->get_active_languages();
|
||||
|
||||
foreach ( $active_languages as $language_code => $language ) {
|
||||
|
||||
$lang_post_id = wpml_object_id_filter( $user_page_id, 'post', false, $language_code );
|
||||
$lang_post_id = wpml_object_id_filter( $user_page_id, 'post', false, $language_code );
|
||||
$lang_post_obj = get_post( $lang_post_id );
|
||||
|
||||
if ( isset( $lang_post_obj->post_name ) && $lang_post_obj->post_name != $user->post_name ) {
|
||||
$user_slug = $lang_post_obj->post_name;
|
||||
if ( isset( $lang_post_obj->post_name ) && $lang_post_obj->post_name !== $user->post_name ) {
|
||||
$user_slug = $lang_post_obj->post_name;
|
||||
$newrules[ $user_slug . '/([^/]+)/?$' ] = 'index.php?page_id=' . $lang_post_id . '&um_user=$matches[1]&lang=' . $language_code;
|
||||
}
|
||||
}
|
||||
@@ -117,13 +108,11 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
}
|
||||
|
||||
if ( isset( UM()->config()->permalinks['account'] ) ) {
|
||||
|
||||
$account_page_id = UM()->config()->permalinks['account'];
|
||||
$account = get_post( $account_page_id );
|
||||
$account = get_post( $account_page_id );
|
||||
|
||||
if ( isset( $account->post_name ) ) {
|
||||
|
||||
$account_slug = $account->post_name;
|
||||
$account_slug = $account->post_name;
|
||||
$newrules[ $account_slug . '/([^/]+)?$' ] = 'index.php?page_id=' . $account_page_id . '&um_tab=$matches[1]';
|
||||
}
|
||||
|
||||
@@ -133,12 +122,11 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
$active_languages = $sitepress->get_active_languages();
|
||||
|
||||
foreach ( $active_languages as $language_code => $language ) {
|
||||
|
||||
$lang_post_id = wpml_object_id_filter( $account_page_id, 'post', false, $language_code );
|
||||
$lang_post_id = wpml_object_id_filter( $account_page_id, 'post', false, $language_code );
|
||||
$lang_post_obj = get_post( $lang_post_id );
|
||||
|
||||
if ( isset( $lang_post_obj->post_name ) && $lang_post_obj->post_name != $account->post_name ) {
|
||||
$account_slug = $lang_post_obj->post_name;
|
||||
if ( isset( $lang_post_obj->post_name ) && $lang_post_obj->post_name !== $account->post_name ) {
|
||||
$account_slug = $lang_post_obj->post_name;
|
||||
$newrules[ $account_slug . '/([^/]+)/?$' ] = 'index.php?page_id=' . $lang_post_id . '&um_user=$matches[1]&lang=' . $language_code;
|
||||
}
|
||||
}
|
||||
@@ -148,47 +136,49 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
return $newrules + $rules;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Author page to user profile redirect
|
||||
* Author page to user profile redirect.
|
||||
*/
|
||||
function redirect_author_page() {
|
||||
if ( UM()->options()->get( 'author_redirect' ) && is_author() ) {
|
||||
public function redirect_author_page() {
|
||||
if ( is_author() && UM()->options()->get( 'author_redirect' ) ) {
|
||||
$id = get_query_var( 'author' );
|
||||
um_fetch_user( $id );
|
||||
exit( wp_redirect( um_user_profile_url() ) );
|
||||
wp_safe_redirect( um_user_profile_url() );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Locate/display a profile
|
||||
* Locate/display a profile.
|
||||
*/
|
||||
function locate_user_profile() {
|
||||
public function locate_user_profile() {
|
||||
$permalink_base = UM()->options()->get( 'permalink_base' );
|
||||
if ( 'custom_meta' === $permalink_base ) {
|
||||
$custom_meta = UM()->options()->get( 'permalink_base_custom_meta' );
|
||||
if ( empty( $custom_meta ) ) {
|
||||
// Set default permalink base if custom meta is empty.
|
||||
$permalink_base = 'user_login';
|
||||
}
|
||||
}
|
||||
|
||||
if ( um_queried_user() && um_is_core_page( 'user' ) ) {
|
||||
|
||||
if ( UM()->options()->get( 'permalink_base' ) == 'user_login' ) {
|
||||
|
||||
if ( 'user_login' === $permalink_base ) {
|
||||
$user_id = username_exists( um_queried_user() );
|
||||
|
||||
//Try
|
||||
if ( ! $user_id ) {
|
||||
$permalink_base = UM()->options()->get( 'permalink_base' );
|
||||
|
||||
// Search by Profile Slug
|
||||
$args = array(
|
||||
"fields" => 'ids',
|
||||
'fields' => 'ids',
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => 'um_user_profile_url_slug_' . $permalink_base,
|
||||
'value' => strtolower( um_queried_user() ),
|
||||
'compare' => '='
|
||||
)
|
||||
'key' => 'um_user_profile_url_slug_' . $permalink_base,
|
||||
'value' => strtolower( um_queried_user() ),
|
||||
'compare' => '=',
|
||||
),
|
||||
),
|
||||
'number' => 1
|
||||
'number' => 1,
|
||||
);
|
||||
|
||||
|
||||
$ids = new \WP_User_Query( $args );
|
||||
if ( $ids->total_users > 0 ) {
|
||||
$user_id = current( $ids->get_results() );
|
||||
@@ -197,10 +187,10 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
|
||||
// Try nice name
|
||||
if ( ! $user_id ) {
|
||||
$slug = um_queried_user();
|
||||
$slug = str_replace( '.', '-', $slug );
|
||||
$slug = um_queried_user();
|
||||
$slug = str_replace( '.', '-', $slug );
|
||||
$the_user = get_user_by( 'slug', $slug );
|
||||
if ( isset( $the_user->ID ) ){
|
||||
if ( isset( $the_user->ID ) ) {
|
||||
$user_id = $the_user->ID;
|
||||
}
|
||||
|
||||
@@ -211,56 +201,50 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
if ( ! $user_id ) {
|
||||
$user_id = UM()->user()->user_exists_by_email_as_username( $slug );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( UM()->options()->get( 'permalink_base' ) == 'user_id' ) {
|
||||
if ( 'user_id' === $permalink_base ) {
|
||||
$user_id = UM()->user()->user_exists_by_id( um_queried_user() );
|
||||
}
|
||||
|
||||
if ( in_array( UM()->options()->get( 'permalink_base' ), array( 'name', 'name_dash', 'name_dot', 'name_plus' ) ) ) {
|
||||
if ( 'hash' === $permalink_base ) {
|
||||
$user_id = UM()->user()->user_exists_by_hash( um_queried_user() );
|
||||
}
|
||||
|
||||
if ( 'custom_meta' === $permalink_base ) {
|
||||
$user_id = UM()->user()->user_exists_by_custom_meta( um_queried_user() );
|
||||
}
|
||||
|
||||
if ( in_array( $permalink_base, array( 'name', 'name_dash', 'name_dot', 'name_plus' ), true ) ) {
|
||||
$user_id = UM()->user()->user_exists_by_name( um_queried_user() );
|
||||
}
|
||||
|
||||
/** USER EXISTS SET USER AND CONTINUE **/
|
||||
|
||||
if ( $user_id ) {
|
||||
|
||||
if ( ! empty( $user_id ) ) {
|
||||
um_set_requested_user( $user_id );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
* Fires after setting requested user.
|
||||
*
|
||||
* @type action
|
||||
* @title um_access_profile
|
||||
* @description Action on user access profile
|
||||
* @input_vars
|
||||
* [{"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_access_profile', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* @param {int} $user_id Requested User ID.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_access_profile
|
||||
*
|
||||
* @example <caption>Some action on user access profile and requested user isset.</caption>
|
||||
* add_action( 'um_access_profile', 'my_access_profile', 10, 1 );
|
||||
* function my_access_profile( $user_id ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_access_profile', $user_id );
|
||||
|
||||
} else {
|
||||
|
||||
exit( wp_redirect( um_get_core_page( 'user' ) ) );
|
||||
|
||||
wp_safe_redirect( um_get_core_page( 'user' ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
} elseif ( um_is_core_page( 'user' ) ) {
|
||||
|
||||
if ( is_user_logged_in() ) { // just redirect to their profile
|
||||
|
||||
$query = UM()->permalinks()->get_query_array();
|
||||
|
||||
$url = um_user_profile_url( um_user( 'ID' ) );
|
||||
@@ -270,41 +254,33 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
$url = add_query_arg( $key, $val, $url );
|
||||
}
|
||||
}
|
||||
|
||||
exit( wp_redirect( $url ) );
|
||||
} else {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_locate_user_profile_not_loggedin__redirect
|
||||
* @description Change redirect URL from user profile for not logged in user
|
||||
* @input_vars
|
||||
* [{"var":"$url","type":"string","desc":"Redirect URL"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_locate_user_profile_not_loggedin__redirect', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_locate_user_profile_not_loggedin__redirect', 'my_user_profile_not_loggedin__redirect', 10, 1 );
|
||||
* function my_user_profile_not_loggedin__redirect( $url ) {
|
||||
* // your code here
|
||||
* return $url;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$redirect_to = apply_filters( 'um_locate_user_profile_not_loggedin__redirect', home_url() );
|
||||
if ( ! empty( $redirect_to ) ) {
|
||||
exit( wp_redirect( $redirect_to ) );
|
||||
}
|
||||
|
||||
wp_safe_redirect( $url );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the redirect URL from user profile for not logged-in user.
|
||||
*
|
||||
* @param {string} $url Redirect URL. By default, it's a home page.
|
||||
*
|
||||
* @return {string} Redirect URL.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_locate_user_profile_not_loggedin__redirect
|
||||
*
|
||||
* @example <caption>Change redirect URL from user profile for not logged-in user to WordPress native login.</caption>
|
||||
* function my_user_profile_not_loggedin__redirect( $url ) {
|
||||
* // your code here
|
||||
* $url = wp_login_url();
|
||||
* return $url;
|
||||
* }
|
||||
* add_filter( 'um_locate_user_profile_not_loggedin__redirect', 'my_user_profile_not_loggedin__redirect' );
|
||||
*/
|
||||
$redirect_to = apply_filters( 'um_locate_user_profile_not_loggedin__redirect', home_url() );
|
||||
if ( ! empty( $redirect_to ) ) {
|
||||
um_safe_redirect( $redirect_to );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+231
-97
@@ -440,11 +440,11 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
$md_data = get_user_meta( $object_id, 'um_member_directory_data', true );
|
||||
if ( empty( $md_data ) ) {
|
||||
$md_data = array(
|
||||
'account_status' => 'approved',
|
||||
'hide_in_members' => UM()->member_directory()->get_hide_in_members_default(),
|
||||
'profile_photo' => false,
|
||||
'cover_photo' => false,
|
||||
'verified' => false,
|
||||
'account_status' => 'approved',
|
||||
'hide_in_members' => UM()->member_directory()->get_hide_in_members_default(),
|
||||
'profile_photo' => false,
|
||||
'cover_photo' => false,
|
||||
'verified' => false,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
break;
|
||||
case 'synced_gravatar_hashed_id':
|
||||
if ( UM()->options()->get( 'use_gravatars' ) ) {
|
||||
$profile_photo = get_user_meta( $object_id, 'profile_photo', true );
|
||||
$profile_photo = get_user_meta( $object_id, 'profile_photo', true );
|
||||
$synced_profile_photo = get_user_meta( $object_id, 'synced_profile_photo', true );
|
||||
|
||||
$md_data['profile_photo'] = ! empty( $profile_photo ) || ! empty( $synced_profile_photo );
|
||||
@@ -514,11 +514,11 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
$md_data = get_user_meta( $object_id, 'um_member_directory_data', true );
|
||||
if ( empty( $md_data ) ) {
|
||||
$md_data = array(
|
||||
'account_status' => 'approved',
|
||||
'hide_in_members' => UM()->member_directory()->get_hide_in_members_default(),
|
||||
'profile_photo' => false,
|
||||
'cover_photo' => false,
|
||||
'verified' => false,
|
||||
'account_status' => 'approved',
|
||||
'hide_in_members' => UM()->member_directory()->get_hide_in_members_default(),
|
||||
'profile_photo' => false,
|
||||
'cover_photo' => false,
|
||||
'verified' => false,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -527,7 +527,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
$md_data['account_status'] = $_meta_value;
|
||||
break;
|
||||
case 'hide_in_members':
|
||||
|
||||
$hide_in_members = UM()->member_directory()->get_hide_in_members_default();
|
||||
if ( ! empty( $_meta_value ) ) {
|
||||
if ( $_meta_value == 'Yes' || $_meta_value == __( 'Yes', 'ultimate-member' ) ||
|
||||
@@ -704,14 +703,26 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*
|
||||
* @return bool|mixed
|
||||
*/
|
||||
function get_profile_slug( $user_id ) {
|
||||
public function get_profile_slug( $user_id ) {
|
||||
// Permalink base
|
||||
$permalink_base = UM()->options()->get( 'permalink_base' );
|
||||
$profile_slug = get_user_meta( $user_id, "um_user_profile_url_slug_{$permalink_base}", true );
|
||||
if ( 'custom_meta' === $permalink_base ) {
|
||||
$custom_meta = UM()->options()->get( 'permalink_base_custom_meta' );
|
||||
if ( empty( $custom_meta ) ) {
|
||||
// Set default permalink base if custom meta is empty.
|
||||
$permalink_base = 'user_login';
|
||||
$meta_key = 'um_user_profile_url_slug_' . $permalink_base;
|
||||
} else {
|
||||
$meta_key = $custom_meta;
|
||||
}
|
||||
} else {
|
||||
$meta_key = 'um_user_profile_url_slug_' . $permalink_base;
|
||||
}
|
||||
$profile_slug = get_user_meta( $user_id, $meta_key, true );
|
||||
|
||||
//get default username permalink if it's empty then return false
|
||||
if ( empty( $profile_slug ) ) {
|
||||
if ( $permalink_base != 'user_login' ) {
|
||||
if ( 'user_login' !== $permalink_base ) {
|
||||
$profile_slug = get_user_meta( $user_id, 'um_user_profile_url_slug_user_login', true );
|
||||
}
|
||||
|
||||
@@ -723,7 +734,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
return $profile_slug;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $user_id
|
||||
*
|
||||
@@ -739,6 +749,20 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
return UM()->permalinks()->profile_permalink( $profile_slug );
|
||||
}
|
||||
|
||||
public function generate_user_hash( $user_id ) {
|
||||
$user_id = absint( $user_id );
|
||||
$append = 0;
|
||||
|
||||
while ( 1 ) {
|
||||
$user_in_url = '~' . substr( strrev( md5( uniqid( 'um_user_hash' . $append, true ) . $user_id ) ), 0, 18 );
|
||||
$slug_exists_user_id = UM()->permalinks()->slug_exists_user_id( $user_in_url );
|
||||
if ( empty( $slug_exists_user_id ) || $user_id === $slug_exists_user_id ) {
|
||||
break;
|
||||
}
|
||||
$append++;
|
||||
}
|
||||
return $user_in_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate User Profile Slug and save to meta
|
||||
@@ -746,7 +770,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
* @param int $user_id
|
||||
* @param bool $force
|
||||
*/
|
||||
function generate_profile_slug( $user_id, $force = false ) {
|
||||
public function generate_profile_slug( $user_id, $force = false ) {
|
||||
$userdata = get_userdata( $user_id );
|
||||
|
||||
if ( empty( $userdata ) ) {
|
||||
@@ -757,16 +781,31 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
$current_profile_slug = $this->get_profile_slug( $user_id );
|
||||
|
||||
$user_in_url = '';
|
||||
$user_in_url = '';
|
||||
$permalink_base = UM()->options()->get( 'permalink_base' );
|
||||
|
||||
// User ID
|
||||
if ( $permalink_base == 'user_id' ) {
|
||||
if ( 'user_id' === $permalink_base ) {
|
||||
$user_in_url = $user_id;
|
||||
}
|
||||
|
||||
if ( 'hash' === $permalink_base ) {
|
||||
$user_in_url = $this->generate_user_hash( $user_id );
|
||||
}
|
||||
|
||||
if ( 'custom_meta' === $permalink_base ) {
|
||||
$custom_meta = UM()->options()->get( 'permalink_base_custom_meta' );
|
||||
if ( empty( $custom_meta ) ) {
|
||||
// Set default permalink base if custom meta is empty.
|
||||
$permalink_base = 'user_login';
|
||||
} else {
|
||||
$user_in_url = rawurlencode( get_user_meta( $user_id, $custom_meta, true ) );
|
||||
$user_in_url = apply_filters( 'um_custom_meta_permalink_base_generate_user_slug', $user_in_url, $user_id, $custom_meta );
|
||||
}
|
||||
}
|
||||
|
||||
// Username
|
||||
if ( $permalink_base == 'user_login' ) {
|
||||
if ( 'user_login' === $permalink_base ) {
|
||||
|
||||
$user_in_url = $userdata->user_login;
|
||||
|
||||
@@ -790,21 +829,25 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
// Fisrt and Last name
|
||||
$full_name_permalinks = array( 'name', 'name_dash', 'name_plus' );
|
||||
if ( in_array( $permalink_base, $full_name_permalinks ) ) {
|
||||
$separated = array( 'name' => '.', 'name_dash' => '-', 'name_plus' => '+' );
|
||||
$separate = $separated[ $permalink_base ];
|
||||
$first_name = $userdata->first_name;
|
||||
$last_name = $userdata->last_name;
|
||||
$full_name = trim( sprintf( '%s %s', $first_name, $last_name ) );
|
||||
$full_name = preg_replace( '/\s+/', ' ', $full_name ); // Remove double spaces
|
||||
if ( in_array( $permalink_base, $full_name_permalinks, true ) ) {
|
||||
$separated = array(
|
||||
'name' => '.',
|
||||
'name_dash' => '-',
|
||||
'name_plus' => '+',
|
||||
);
|
||||
$separate = $separated[ $permalink_base ];
|
||||
$first_name = $userdata->first_name;
|
||||
$last_name = $userdata->last_name;
|
||||
$full_name = trim( sprintf( '%s %s', $first_name, $last_name ) );
|
||||
$full_name = preg_replace( '/\s+/', ' ', $full_name ); // Remove double spaces
|
||||
$profile_slug = UM()->permalinks()->profile_slug( $full_name, $first_name, $last_name );
|
||||
|
||||
$append = 0;
|
||||
$username = $full_name;
|
||||
$_username = $full_name;
|
||||
$append = 0;
|
||||
$username = $full_name;
|
||||
$_username = $full_name;
|
||||
|
||||
while ( 1 ) {
|
||||
$username = $_username . ( empty( $append ) ? '' : " $append" );
|
||||
$username = $_username . ( empty( $append ) ? '' : " $append" );
|
||||
$slug_exists_user_id = UM()->permalinks()->slug_exists_user_id( $profile_slug . ( empty( $append ) ? '' : "{$separate}{$append}" ) );
|
||||
if ( empty( $slug_exists_user_id ) || $user_id == $slug_exists_user_id ) {
|
||||
break;
|
||||
@@ -839,12 +882,11 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
$user_in_url = apply_filters( 'um_change_user_profile_slug', $user_in_url, $user_id );
|
||||
|
||||
if ( $force || empty( $current_profile_slug ) || $current_profile_slug != $user_in_url ) {
|
||||
if ( $force || empty( $current_profile_slug ) || $current_profile_slug !== $user_in_url ) {
|
||||
update_user_meta( $user_id, "um_user_profile_url_slug_{$permalink_base}", $user_in_url );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Backend user creation
|
||||
*
|
||||
@@ -961,7 +1003,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
if ( $userdata !== 'add-new-user' && $userdata !== 'add-existing-user' ) { ?>
|
||||
<h3 id="um_user_screen_block"><?php esc_html_e( 'Ultimate Member', 'ultimate-member' ); ?></h3>
|
||||
<?php }
|
||||
<?php
|
||||
}
|
||||
|
||||
echo $section_content;
|
||||
}
|
||||
@@ -998,7 +1041,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$style = '';
|
||||
$style = '';
|
||||
$user_role = false;
|
||||
if ( $userdata !== 'add-new-user' && $userdata !== 'add-existing-user' ) {
|
||||
// Bail if current user cannot edit users
|
||||
@@ -1010,21 +1053,21 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
if ( $user_role && ! empty( $userdata->roles ) && count( $userdata->roles ) == 1 ) {
|
||||
$style = 'style="display:none;"';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$class = ( $userdata == 'add-existing-user' ) ? 'um_role_existing_selector_wrapper' : 'um_role_selector_wrapper';
|
||||
|
||||
ob_start(); ?>
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div id="<?php echo esc_attr( $class ) ?>" <?php echo $style ?>>
|
||||
<div id="<?php echo esc_attr( $class ); ?>" <?php echo $style; ?>>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><label for="um-role"><?php esc_html_e( 'Ultimate Member Role', 'ultimate-member' ); ?></label></th>
|
||||
<td>
|
||||
<select name="um-role" id="um-role">
|
||||
<option value="" <?php selected( empty( $user_role ) ) ?>><?php esc_html_e( '— No role for Ultimate Member —', 'ultimate-member' ); ?></option>
|
||||
<option value="" <?php selected( empty( $user_role ) ); ?>><?php esc_html_e( '— No role for Ultimate Member —', 'ultimate-member' ); ?></option>
|
||||
<?php foreach ( $roles as $role_id => $details ) { ?>
|
||||
<option <?php selected( $user_role, $role_id ); ?> value="<?php echo esc_attr( $role_id ); ?>"><?php echo esc_html( $details['name'] ); ?></option>
|
||||
<?php } ?>
|
||||
@@ -1035,7 +1078,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php $content .= ob_get_clean();
|
||||
<?php
|
||||
$content .= ob_get_clean();
|
||||
|
||||
return $content;
|
||||
}
|
||||
@@ -1179,21 +1223,21 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
if ( $user_id ) {
|
||||
|
||||
$this->id = $user_id;
|
||||
$this->id = $user_id;
|
||||
$this->usermeta = get_user_meta( $user_id );
|
||||
$this->data = get_userdata( $this->id );
|
||||
$this->data = get_userdata( $this->id );
|
||||
|
||||
} elseif ( is_user_logged_in() && $clean == false ) {
|
||||
|
||||
$this->id = get_current_user_id();
|
||||
$this->usermeta = get_user_meta($this->id);
|
||||
$this->data = get_userdata($this->id);
|
||||
$this->id = get_current_user_id();
|
||||
$this->usermeta = get_user_meta( $this->id );
|
||||
$this->data = get_userdata( $this->id );
|
||||
|
||||
} else {
|
||||
|
||||
$this->id = 0;
|
||||
$this->id = 0;
|
||||
$this->usermeta = null;
|
||||
$this->data = null;
|
||||
$this->data = null;
|
||||
|
||||
}
|
||||
|
||||
@@ -1203,54 +1247,54 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
// add user data
|
||||
$this->data = $this->toArray( $this->data );
|
||||
|
||||
foreach ( $this->data as $k=>$v ) {
|
||||
if ( $k == 'roles') {
|
||||
$this->profile['wp_roles'] = implode(',',$v);
|
||||
} else if ( is_array( $v ) ) {
|
||||
foreach($v as $k2 => $v2){
|
||||
$this->profile[$k2] = $v2;
|
||||
foreach ( $this->data as $k => $v ) {
|
||||
if ( $k == 'roles' ) {
|
||||
$this->profile['wp_roles'] = implode( ',', $v );
|
||||
} elseif ( is_array( $v ) ) {
|
||||
foreach ( $v as $k2 => $v2 ) {
|
||||
$this->profile[ $k2 ] = $v2;
|
||||
}
|
||||
} else {
|
||||
$this->profile[$k] = $v;
|
||||
$this->profile[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
// add account status
|
||||
if ( !isset( $this->usermeta['account_status'][0] ) ) {
|
||||
if ( ! isset( $this->usermeta['account_status'][0] ) ) {
|
||||
$this->usermeta['account_status'][0] = 'approved';
|
||||
}
|
||||
|
||||
if ( $this->usermeta['account_status'][0] == 'approved' ) {
|
||||
$this->usermeta['account_status_name'][0] = __('Approved','ultimate-member');
|
||||
$this->usermeta['account_status_name'][0] = __( 'Approved', 'ultimate-member' );
|
||||
}
|
||||
|
||||
if ( $this->usermeta['account_status'][0] == 'awaiting_email_confirmation' ) {
|
||||
$this->usermeta['account_status_name'][0] = __('Awaiting E-mail Confirmation','ultimate-member');
|
||||
$this->usermeta['account_status_name'][0] = __( 'Awaiting E-mail Confirmation', 'ultimate-member' );
|
||||
}
|
||||
|
||||
if ( $this->usermeta['account_status'][0] == 'awaiting_admin_review' ) {
|
||||
$this->usermeta['account_status_name'][0] = __('Pending Review','ultimate-member');
|
||||
$this->usermeta['account_status_name'][0] = __( 'Pending Review', 'ultimate-member' );
|
||||
}
|
||||
|
||||
if ( $this->usermeta['account_status'][0] == 'rejected' ) {
|
||||
$this->usermeta['account_status_name'][0] = __('Membership Rejected','ultimate-member');
|
||||
$this->usermeta['account_status_name'][0] = __( 'Membership Rejected', 'ultimate-member' );
|
||||
}
|
||||
|
||||
if ( $this->usermeta['account_status'][0] == 'inactive' ) {
|
||||
$this->usermeta['account_status_name'][0] = __('Membership Inactive','ultimate-member');
|
||||
$this->usermeta['account_status_name'][0] = __( 'Membership Inactive', 'ultimate-member' );
|
||||
}
|
||||
|
||||
// add user meta
|
||||
foreach ( $this->usermeta as $k => $v ) {
|
||||
if ( $k == 'display_name') {
|
||||
if ( $k == 'display_name' ) {
|
||||
continue;
|
||||
}
|
||||
$this->profile[ $k ] = $v[0];
|
||||
}
|
||||
|
||||
// add permissions
|
||||
$user_role = UM()->roles()->get_priority_user_role( $this->id );
|
||||
$this->profile['role'] = $user_role;
|
||||
$user_role = UM()->roles()->get_priority_user_role( $this->id );
|
||||
$this->profile['role'] = $user_role;
|
||||
$this->profile['roles'] = UM()->roles()->get_all_user_roles( $this->id );
|
||||
|
||||
$role_meta = UM()->roles()->role_data( $user_role );
|
||||
@@ -1285,7 +1329,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
return array( $key => $item );
|
||||
}, array_keys( $role_meta ), $role_meta );*/
|
||||
|
||||
$this->profile = array_merge( $this->profile, (array)$role_meta );
|
||||
$this->profile = array_merge( $this->profile, (array) $role_meta );
|
||||
|
||||
$this->profile['super_admin'] = ( is_super_admin( $this->id ) ) ? 1 : 0;
|
||||
|
||||
@@ -1296,7 +1340,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
$this->setup_cache( $this->id, $this->profile );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1307,8 +1350,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*
|
||||
* @param bool $clean
|
||||
*/
|
||||
function reset( $clean = false ){
|
||||
$this->set(0, $clean);
|
||||
function reset( $clean = false ) {
|
||||
$this->set( 0, $clean );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1645,7 +1688,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*
|
||||
*/
|
||||
function approve( $repeat = true ) {
|
||||
$user_id = um_user('ID');
|
||||
$user_id = um_user( 'ID' );
|
||||
|
||||
if ( ! $repeat ) {
|
||||
$status = get_user_meta( $user_id, 'account_status', true );
|
||||
@@ -1828,7 +1871,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
if ( is_multisite() ) {
|
||||
|
||||
if ( ! function_exists( 'wpmu_delete_user' ) ) {
|
||||
require_once( ABSPATH . 'wp-admin/includes/ms.php' );
|
||||
require_once ABSPATH . 'wp-admin/includes/ms.php';
|
||||
}
|
||||
|
||||
wpmu_delete_user( $this->id );
|
||||
@@ -1836,7 +1879,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
} else {
|
||||
|
||||
if ( ! function_exists( 'wp_delete_user' ) ) {
|
||||
require_once( ABSPATH . 'wp-admin/includes/user.php' );
|
||||
require_once ABSPATH . 'wp-admin/includes/user.php';
|
||||
}
|
||||
|
||||
wp_delete_user( $this->id );
|
||||
@@ -1951,10 +1994,15 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
}
|
||||
|
||||
foreach ( $actions as $id => $arr ) {
|
||||
$url = add_query_arg( array( 'um_action' => $id, 'uid' => um_profile_id() ) );
|
||||
$url = add_query_arg(
|
||||
array(
|
||||
'um_action' => $id,
|
||||
'uid' => um_profile_id(),
|
||||
)
|
||||
);
|
||||
/*$url = add_query_arg( 'um_action', $id );
|
||||
$url = add_query_arg( 'uid', um_profile_id(), $url );*/
|
||||
$items[] = '<a href="' . esc_url( $url ) .'" class="real_url ' . esc_attr( $id ) . '-item">' . esc_html( $arr['label'] ) . '</a>';
|
||||
$items[] = '<a href="' . esc_url( $url ) . '" class="real_url ' . esc_attr( $id ) . '-item">' . esc_html( $arr['label'] ) . '</a>';
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
@@ -2202,19 +2250,25 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
$value = UM()->validation()->safe_name_in_url( $value );
|
||||
|
||||
$ids = get_users( array( 'fields' => 'ID', 'meta_key' => $key, 'meta_value' => $value, 'meta_compare' => '=' ) );
|
||||
$ids = get_users(
|
||||
array(
|
||||
'fields' => 'ID',
|
||||
'meta_key' => $key,
|
||||
'meta_value' => $value,
|
||||
'meta_compare' => '=',
|
||||
)
|
||||
);
|
||||
if ( ! isset( $ids ) || empty( $ids ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ( $ids as $k => $id ) {
|
||||
|
||||
if ( $id == um_user('ID') ) {
|
||||
if ( $id == um_user( 'ID' ) ) {
|
||||
unset( $ids[ $k ] );
|
||||
} else {
|
||||
$duplicates[] = $id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( ! empty( $duplicates ) ) {
|
||||
@@ -2231,29 +2285,28 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function user_exists_by_name( $value ) {
|
||||
public function user_exists_by_name( $value ) {
|
||||
|
||||
// Permalink base
|
||||
$permalink_base = UM()->options()->get( 'permalink_base' );
|
||||
|
||||
$raw_value = $value;
|
||||
$value = UM()->validation()->safe_name_in_url( $value );
|
||||
$value = um_clean_user_basename( $value );
|
||||
$value = UM()->validation()->safe_name_in_url( $value );
|
||||
$value = um_clean_user_basename( $value );
|
||||
|
||||
// Search by Profile Slug
|
||||
$args = array(
|
||||
'fields' => array( 'ID' ),
|
||||
'fields' => array( 'ID' ),
|
||||
'meta_query' => array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'um_user_profile_url_slug_' . $permalink_base,
|
||||
'value' => strtolower( $raw_value ),
|
||||
'compare' => '=',
|
||||
'key' => 'um_user_profile_url_slug_' . $permalink_base,
|
||||
'value' => strtolower( $raw_value ),
|
||||
'compare' => '=',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
$ids = new \WP_User_Query( $args );
|
||||
|
||||
if ( $ids->total_users > 0 ) {
|
||||
@@ -2263,9 +2316,9 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
// Search by Display Name or ID
|
||||
$args = array(
|
||||
'fields' => array( 'ID' ),
|
||||
'search' => $value,
|
||||
'search_columns' => array( 'display_name', 'ID' ),
|
||||
'fields' => array( 'ID' ),
|
||||
'search' => $value,
|
||||
'search_columns' => array( 'display_name', 'ID' ),
|
||||
);
|
||||
|
||||
$ids = new \WP_User_Query( $args );
|
||||
@@ -2275,17 +2328,15 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
return $um_user_query->ID;
|
||||
}
|
||||
|
||||
|
||||
// Search By User Login
|
||||
$value = str_replace( ".", "_", $value );
|
||||
$value = str_replace( " ", "", $value );
|
||||
$value = str_replace( array( '.', ' ' ), array( '_', '' ), $value );
|
||||
|
||||
$args = array(
|
||||
'fields' => array( 'ID' ),
|
||||
'search' => $value,
|
||||
'search_columns' => array(
|
||||
'fields' => array( 'ID' ),
|
||||
'search' => $value,
|
||||
'search_columns' => array(
|
||||
'user_login',
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$ids = new \WP_User_Query( $args );
|
||||
@@ -2321,7 +2372,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
*
|
||||
*/
|
||||
function user_exists_by_id( $user_id ) {
|
||||
public function user_exists_by_id( $user_id ) {
|
||||
$aux = get_userdata( absint( $user_id ) );
|
||||
if ( $aux == false ) {
|
||||
return false;
|
||||
@@ -2330,6 +2381,84 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $hash
|
||||
*
|
||||
* @return bool|int
|
||||
*/
|
||||
public function user_exists_by_hash( $hash ) {
|
||||
// Permalink base
|
||||
$permalink_base = UM()->options()->get( 'permalink_base' );
|
||||
$raw_value = $hash;
|
||||
|
||||
// Search by Profile Slug
|
||||
$args = array(
|
||||
'fields' => array( 'ID' ),
|
||||
'meta_query' => array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'um_user_profile_url_slug_' . $permalink_base,
|
||||
'value' => strtolower( $raw_value ),
|
||||
'compare' => '=',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$ids = new \WP_User_Query( $args );
|
||||
|
||||
if ( $ids->total_users > 0 ) {
|
||||
$um_user_query = current( $ids->get_results() );
|
||||
return $um_user_query->ID;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $slug
|
||||
*
|
||||
* @return bool|int
|
||||
*/
|
||||
public function user_exists_by_custom_meta( $slug ) {
|
||||
$permalink_base = UM()->options()->get( 'permalink_base' );
|
||||
$custom_meta = UM()->options()->get( 'permalink_base_custom_meta' );
|
||||
if ( empty( $custom_meta ) ) {
|
||||
// Set default permalink base if custom meta is empty.
|
||||
$permalink_base = 'user_login';
|
||||
$meta_key = 'um_user_profile_url_slug_' . $permalink_base;
|
||||
} else {
|
||||
$meta_key = $custom_meta;
|
||||
}
|
||||
|
||||
$raw_value = $slug;
|
||||
|
||||
// Search by Profile Slug
|
||||
$args = array(
|
||||
'fields' => array( 'ID' ),
|
||||
'meta_query' => array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => $meta_key,
|
||||
'value' => strtolower( $raw_value ),
|
||||
'compare' => '=',
|
||||
),
|
||||
array(
|
||||
'key' => 'um_user_profile_url_slug_' . $permalink_base,
|
||||
'value' => strtolower( $raw_value ),
|
||||
'compare' => '=',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$ids = new \WP_User_Query( $args );
|
||||
|
||||
if ( $ids->total_users > 0 ) {
|
||||
$um_user_query = current( $ids->get_results() );
|
||||
return $um_user_query->ID;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method checks if a user exists or not in your site based on the user email as username
|
||||
@@ -2355,7 +2484,12 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
$user_id = false;
|
||||
|
||||
$ids = get_users( array( 'fields' => 'ID', 'meta_key' => 'um_email_as_username_' . $slug ) );
|
||||
$ids = get_users(
|
||||
array(
|
||||
'fields' => 'ID',
|
||||
'meta_key' => 'um_email_as_username_' . $slug,
|
||||
)
|
||||
);
|
||||
if ( ! empty( $ids[0] ) ) {
|
||||
$user_id = $ids[0];
|
||||
}
|
||||
@@ -2373,11 +2507,11 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
function set_gravatar( $user_id ) {
|
||||
|
||||
um_fetch_user( $user_id );
|
||||
$email_address = um_user( 'user_email' );
|
||||
$email_address = um_user( 'user_email' );
|
||||
$hash_email_address = '';
|
||||
|
||||
if ( $email_address ) {
|
||||
$hash_email_address = md5( $email_address );
|
||||
$hash_email_address = md5( $email_address );
|
||||
$this->profile['synced_gravatar_hashed_id'] = $hash_email_address;
|
||||
$this->update_usermeta_info( 'synced_gravatar_hashed_id' );
|
||||
}
|
||||
|
||||
@@ -1,47 +1,49 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main admin user actions
|
||||
* Main admin user actions.
|
||||
*
|
||||
* @param array $actions
|
||||
* @param int $user_id
|
||||
* @param int $user_id
|
||||
*
|
||||
* @return null
|
||||
* @return array
|
||||
*/
|
||||
function um_admin_user_actions_hook( $actions, $user_id ) {
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
$role = get_role( UM()->roles()->get_priority_user_role( get_current_user_id() ) );
|
||||
$can_edit_users = current_user_can( 'edit_users' ) && $role->has_cap( 'edit_users' );
|
||||
|
||||
$can_edit_users = null !== $role && current_user_can( 'edit_users' ) && $role->has_cap( 'edit_users' );
|
||||
if ( $can_edit_users ) {
|
||||
$account_status = um_user( 'account_status' );
|
||||
|
||||
if ( um_user( 'account_status' ) == 'awaiting_admin_review' ) {
|
||||
if ( 'awaiting_admin_review' === $account_status ) {
|
||||
$actions['um_approve_membership'] = array( 'label' => __( 'Approve Membership', 'ultimate-member' ) );
|
||||
$actions['um_reject_membership'] = array( 'label' => __( 'Reject Membership', 'ultimate-member' ) );
|
||||
$actions['um_reject_membership'] = array( 'label' => __( 'Reject Membership', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( um_user( 'account_status' ) == 'rejected' ) {
|
||||
if ( 'rejected' === $account_status ) {
|
||||
$actions['um_approve_membership'] = array( 'label' => __( 'Approve Membership', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( um_user( 'account_status' ) == 'approved' ) {
|
||||
if ( 'approved' === $account_status ) {
|
||||
$actions['um_put_as_pending'] = array( 'label' => __( 'Put as Pending Review', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( um_user( 'account_status' ) == 'awaiting_email_confirmation' ) {
|
||||
if ( 'awaiting_email_confirmation' === $account_status ) {
|
||||
$actions['um_resend_activation'] = array( 'label' => __( 'Resend Activation E-mail', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( um_user( 'account_status' ) != 'inactive' ) {
|
||||
if ( 'inactive' !== $account_status ) {
|
||||
$actions['um_deactivate'] = array( 'label' => __( 'Deactivate this account', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( um_user( 'account_status' ) == 'inactive' ) {
|
||||
if ( 'inactive' === $account_status ) {
|
||||
$actions['um_reenable'] = array( 'label' => __( 'Reactivate this account', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( UM()->roles()->um_current_user_can( 'delete', $user_id ) ) {
|
||||
@@ -56,226 +58,150 @@ function um_admin_user_actions_hook( $actions, $user_id ) {
|
||||
}
|
||||
add_filter( 'um_admin_user_actions_hook', 'um_admin_user_actions_hook', 10, 2 );
|
||||
|
||||
|
||||
/**
|
||||
* Filter user basename
|
||||
* Filter user basename.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return string
|
||||
* @hook_filter: um_clean_user_basename_filter
|
||||
*/
|
||||
function um_clean_user_basename_filter( $value, $raw ){
|
||||
function um_clean_user_basename_filter( $value, $raw ) {
|
||||
$permalink_base = UM()->options()->get( 'permalink_base' );
|
||||
|
||||
$user_query = new WP_User_Query(
|
||||
array(
|
||||
'meta_query' => array(
|
||||
'relation' => 'AND',
|
||||
'meta_query' => array(
|
||||
'relation' => 'AND',
|
||||
array(
|
||||
'key' => 'um_user_profile_url_slug_'.$permalink_base,
|
||||
'key' => 'um_user_profile_url_slug_' . $permalink_base,
|
||||
'value' => $raw,
|
||||
'compare' => '='
|
||||
)
|
||||
'compare' => '=',
|
||||
),
|
||||
),
|
||||
'fields' => array('ID')
|
||||
'fields' => array( 'ID' ),
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
if( $user_query->total_users > 0 ){
|
||||
|
||||
if ( $user_query->total_users > 0 ) {
|
||||
$result = current( $user_query->get_results() );
|
||||
$slugname = '';
|
||||
|
||||
if( isset( $result->ID ) ){
|
||||
$slugname = get_user_meta( $result->ID, 'um_user_profile_url_slug_'.$permalink_base, true );
|
||||
$value = $slugname;
|
||||
if ( isset( $result->ID ) ) {
|
||||
$value = get_user_meta( $result->ID, 'um_user_profile_url_slug_' . $permalink_base, true );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
* Filters the base user permalink value before cleaning.
|
||||
*
|
||||
* @type filter
|
||||
* @title um_permalink_base_before_filter
|
||||
* @description Base permalink before
|
||||
* @input_vars
|
||||
* [{"var":"$permalink","type":"string","desc":"User Permalink"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_permalink_base_before_filter', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_permalink_base_before_filter', 'my_permalink_base_before', 10, 1 );
|
||||
* @param {string} $permalink User Profile permalink.
|
||||
*
|
||||
* @return {string} User Profile permalink.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_permalink_base_before_filter
|
||||
*
|
||||
* @example <caption>Change base permalink before cleaning.</caption>
|
||||
* function my_permalink_base_before( $permalink ) {
|
||||
* // your code here
|
||||
* return $permalink;
|
||||
* }
|
||||
* ?>
|
||||
* add_filter( 'um_permalink_base_before_filter', 'my_permalink_base_before' );
|
||||
*/
|
||||
$value = apply_filters( "um_permalink_base_before_filter", $value );
|
||||
$raw_value = $value;
|
||||
$value = apply_filters( 'um_permalink_base_before_filter', $value );
|
||||
$raw_value = $value;
|
||||
$filter_slug = '';
|
||||
|
||||
switch( $permalink_base ) {
|
||||
switch ( $permalink_base ) {
|
||||
case 'name':
|
||||
|
||||
|
||||
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
|
||||
if ( ! empty( $value ) && strrpos( $value, '_' ) > -1 ) {
|
||||
$value = str_replace( '_', '. ', $value );
|
||||
}
|
||||
|
||||
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
|
||||
if ( ! empty( $value ) && strrpos( $value, '_' ) > -1 ) {
|
||||
$value = str_replace( '_', '-', $value );
|
||||
}
|
||||
|
||||
if( ! empty( $value ) && strrpos( $value ,".") > -1 && strrpos( $raw_value ,"_" ) <= -1 ){
|
||||
if ( ! empty( $value ) && strrpos( $value, '.' ) > -1 && strrpos( $raw_value, '_' ) <= -1 ) {
|
||||
$value = str_replace( '.', ' ', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_permalink_base_after_filter_name
|
||||
* @description Base permalink after if permalink is username
|
||||
* @input_vars
|
||||
* [{"var":"$permalink","type":"string","desc":"User Permalink"},
|
||||
* {"var":"$raw_permalink","type":"string","desc":"RAW User Permalink"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_permalink_base_after_filter_name', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_permalink_base_after_filter_name', 'my_permalink_base_after_filter_name', 10, 2 );
|
||||
* function my_permalink_base_after_filter_name( $permalink, $raw_permalink ) {
|
||||
* // your code here
|
||||
* return $permalink;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters("um_permalink_base_after_filter_name", $value, $raw_value );
|
||||
|
||||
$filter_slug = '_' . $permalink_base;
|
||||
break;
|
||||
|
||||
case 'name_dash':
|
||||
|
||||
if( ! empty( $value ) && strrpos( $value ,"-") > -1 ){
|
||||
if ( ! empty( $value ) && strrpos( $value, '-' ) > -1 ) {
|
||||
$value = str_replace( '-', ' ', $value );
|
||||
}
|
||||
|
||||
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
|
||||
if ( ! empty( $value ) && strrpos( $value, '_' ) > -1 ) {
|
||||
$value = str_replace( '_', '-', $value );
|
||||
}
|
||||
|
||||
// Checks if last name has a dash
|
||||
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
|
||||
if ( ! empty( $value ) && strrpos( $value, '_' ) > -1 ) {
|
||||
$value = str_replace( '_', '-', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_permalink_base_after_filter_name_dash
|
||||
* @description Base permalink after if permalink is first name - last name
|
||||
* @input_vars
|
||||
* [{"var":"$permalink","type":"string","desc":"User Permalink"},
|
||||
* {"var":"$raw_permalink","type":"string","desc":"RAW User Permalink"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_permalink_base_after_filter_name_dash', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_permalink_base_after_filter_name_dash', 'my_permalink_base_after_filter_name_dash', 10, 2 );
|
||||
* function my_permalink_base_after_filter_name_dash( $permalink, $raw_permalink ) {
|
||||
* // your code here
|
||||
* return $permalink;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters("um_permalink_base_after_filter_name_dash", $value, $raw_value );
|
||||
|
||||
$filter_slug = '_' . $permalink_base;
|
||||
break;
|
||||
|
||||
|
||||
case 'name_plus':
|
||||
|
||||
if( ! empty( $value ) && strrpos( $value ,"+") > -1 ){
|
||||
if ( ! empty( $value ) && strrpos( $value, '+' ) > -1 ) {
|
||||
$value = str_replace( '+', ' ', $value );
|
||||
}
|
||||
|
||||
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
|
||||
if ( ! empty( $value ) && strrpos( $value, '_' ) > -1 ) {
|
||||
$value = str_replace( '_', '+', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_permalink_base_after_filter_name_plus
|
||||
* @description Base permalink after if permalink is first name + last name
|
||||
* @input_vars
|
||||
* [{"var":"$permalink","type":"string","desc":"User Permalink"},
|
||||
* {"var":"$raw_permalink","type":"string","desc":"RAW User Permalink"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_permalink_base_after_filter_name_plus', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_permalink_base_after_filter_name_plus', 'my_permalink_base_after_filter_name_plus', 10, 2 );
|
||||
* function my_permalink_base_after_filter_name_plus( $permalink, $raw_permalink ) {
|
||||
* // your code here
|
||||
* return $permalink;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters("um_permalink_base_after_filter_name_plus", $value, $raw_value );
|
||||
|
||||
$filter_slug = '_' . $permalink_base;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
// Checks if last name has a dash
|
||||
if( ! empty( $value ) && strrpos( $value ,"_") > -1 && substr( $value , "_") == 1 ){
|
||||
if ( ! empty( $value ) && strrpos( $value, '_' ) > -1 ) {
|
||||
$value = str_replace( '_', '-', $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_permalink_base_after_filter
|
||||
* @description Base permalink after for default permalink
|
||||
* @input_vars
|
||||
* [{"var":"$permalink","type":"string","desc":"User Permalink"},
|
||||
* {"var":"$raw_permalink","type":"string","desc":"RAW User Permalink"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_permalink_base_after_filter', 'function_name', 10, 2 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_permalink_base_after_filter', 'my_permalink_base_after', 10, 2 );
|
||||
* function my_permalink_base_after( $permalink, $raw_permalink ) {
|
||||
* // your code here
|
||||
* return $permalink;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$value = apply_filters("um_permalink_base_after_filter", $value, $raw_value );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
/**
|
||||
* Filters the base user permalink value after cleaning.
|
||||
* $filter_slug - can be empty '' or equals 'name', 'name_dash', 'name_plus'
|
||||
*
|
||||
* @param {string} $permalink User Profile permalink.
|
||||
* @param {string} $raw_value The base user permalink value before cleaning.
|
||||
*
|
||||
* @return {string} User Profile permalink.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_permalink_base_after_filter{$filter_slug}
|
||||
*
|
||||
* @example <caption>Change base permalink after cleaning if permalink settings isn't connected with user first or last name.</caption>
|
||||
* function my_permalink_base_after_filter( $permalink, $raw_permalink ) {
|
||||
* // your code here
|
||||
* return $permalink;
|
||||
* }
|
||||
* add_filter( 'um_permalink_base_after_filter', 'my_permalink_base_after_filter', 10, 2 );
|
||||
* @example <caption>Change base permalink after cleaning if permalink settings is a full name.</caption>
|
||||
* function my_permalink_base_after_filter_name( $permalink, $raw_permalink ) {
|
||||
* // your code here
|
||||
* return $permalink;
|
||||
* }
|
||||
* add_filter( 'um_permalink_base_after_filter_name', 'my_permalink_base_after_filter_name', 10, 2 );
|
||||
* @example <caption>Change base permalink after cleaning if permalink settings is a full name connected by dash.</caption>
|
||||
* function my_permalink_base_after_filter_name_dash( $permalink, $raw_permalink ) {
|
||||
* // your code here
|
||||
* return $permalink;
|
||||
* }
|
||||
* add_filter( 'um_permalink_base_after_filter_name_dash', 'my_permalink_base_after_filter_name_dash', 10, 2 );
|
||||
* @example <caption>Change base permalink after cleaning if permalink settings is a full name connected by plus.</caption>
|
||||
* function my_permalink_base_after_filter_name_plus( $permalink, $raw_permalink ) {
|
||||
* // your code here
|
||||
* return $permalink;
|
||||
* }
|
||||
* add_filter( 'um_permalink_base_after_filter_name_plus', 'my_permalink_base_after_filter_name_plus', 10, 2 );
|
||||
*/
|
||||
return apply_filters( "um_permalink_base_after_filter{$filter_slug}", $value, $raw_value );
|
||||
}
|
||||
add_filter( 'um_clean_user_basename_filter', 'um_clean_user_basename_filter', 2, 10 );
|
||||
|
||||
|
||||
/**
|
||||
* Filter before update profile to force utf8 strings
|
||||
*
|
||||
@@ -296,4 +222,4 @@ function um_before_update_profile( $changes, $user_id ) {
|
||||
|
||||
return $changes;
|
||||
}
|
||||
add_filter( 'um_before_update_profile','um_before_update_profile', 10, 2 );
|
||||
add_filter( 'um_before_update_profile', 'um_before_update_profile', 10, 2 );
|
||||
|
||||
Reference in New Issue
Block a user