mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Version 1.0.44
This commit is contained in:
@@ -81,55 +81,6 @@
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
/*
|
||||
- Nav
|
||||
*/
|
||||
|
||||
.um-admin-dash-nav {
|
||||
float: left;
|
||||
width: 202px;
|
||||
min-height: 300px;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.um-admin-dash-nav a {
|
||||
font-family: Open Sans;
|
||||
font-size: 14px;
|
||||
position: relative;
|
||||
display: block;
|
||||
padding: 10px 4px 10px 14px;
|
||||
border-width: 1px 0px;
|
||||
border-style: solid;
|
||||
border-bottom: 1px solid #E7E7E7;
|
||||
border-top: 0px none;
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
transition: none 0s ease 0s;
|
||||
background: transparent !important;
|
||||
color: #555 !important;
|
||||
}
|
||||
|
||||
.um-admin-dash-nav-title {
|
||||
padding-left: 30px;
|
||||
}
|
||||
|
||||
.um-admin-dash-nav a:hover {
|
||||
background: #ddd !important;
|
||||
}
|
||||
|
||||
.um-admin-dash-nav a.active,
|
||||
.um-admin-dash-nav a.active:hover {
|
||||
color: #3ba1da !important;
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
.um-admin-dash-nav a i {
|
||||
vertical-align: middle;
|
||||
font-size: 1.35em;
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
}
|
||||
|
||||
/*
|
||||
- Main
|
||||
*/
|
||||
@@ -139,8 +90,6 @@
|
||||
border-left: 1px solid #D8D8D8;
|
||||
padding: 0 30px 30px 30px;
|
||||
box-shadow: 0px 1px 0px #FFF inset;
|
||||
min-height: 300px;
|
||||
|
||||
border-left: none;
|
||||
margin-left: 0;
|
||||
}
|
||||
@@ -151,9 +100,10 @@
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.um-admin-dash-content {
|
||||
display: none;
|
||||
display: block;
|
||||
.um-admin-dash-main h4{
|
||||
font-weight: 500;
|
||||
padding: 30px 0 10px 0;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.um-admin-dash-review {
|
||||
@@ -187,6 +137,20 @@
|
||||
- Dashboard styles
|
||||
*/
|
||||
|
||||
.um-admin-dash-four-col .um-admin-dash-col {
|
||||
float: left;
|
||||
width: 25%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.um-admin-dash-three-col {border-bottom: 1px solid #ddd;padding-bottom: 25px}
|
||||
|
||||
.um-admin-dash-three-col .um-admin-dash-col {
|
||||
float: left;
|
||||
width: 33%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.um-admin-dash-two-col .um-admin-dash-col {
|
||||
display: inline-block;
|
||||
width: 46%;
|
||||
@@ -197,6 +161,13 @@
|
||||
.um-admin-dash-col a:hover {text-decoration: underline}
|
||||
.um-admin-dash-col a {text-decoration: none}
|
||||
|
||||
.um-admin-dash-num {
|
||||
display: inline-block;
|
||||
margin: 8px 0 0 0;
|
||||
font-size: 28px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.um-admin-dash-item {
|
||||
padding: 5px 0;
|
||||
vertical-align: middle;
|
||||
|
||||
@@ -95,13 +95,13 @@ body.um-admin-modal-open {
|
||||
|
||||
.um-admin a.button-primary,
|
||||
.um-admin input.button-primary {
|
||||
background: #3ba1da !important;
|
||||
background: #3ba1da;
|
||||
box-shadow: none !important;
|
||||
border-radius: 2px;
|
||||
color: #fff;
|
||||
}
|
||||
.um-admin a.button-primary:hover,
|
||||
.um-admin input.button-primary:hover {background: #44b0ec !important;}
|
||||
.um-admin input.button-primary:hover {background: #44b0ec;}
|
||||
|
||||
/*
|
||||
- Form Inputs
|
||||
|
||||
@@ -232,9 +232,7 @@ class UM_Admin_Enqueue {
|
||||
if ( strstr( $screen_id, 'ultimatemember') || strstr( $screen_id, 'um_') || strstr($screen_id, 'user') || strstr($screen_id, 'profile') )return true;
|
||||
|
||||
if ( $screen_id == 'nav-menus' ) return true;
|
||||
|
||||
if ( isset( $post->post_type ) ) return true;
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
@@ -252,36 +250,33 @@ class UM_Admin_Enqueue {
|
||||
*** @Enqueue scripts and styles
|
||||
***/
|
||||
function admin_enqueue_scripts(){
|
||||
global $ultimatemember;
|
||||
global $ultimatemember, $post;
|
||||
|
||||
if ( $this->is_UM_admin() ) {
|
||||
|
||||
$ultimatemember->styles->wp_enqueue_scripts();
|
||||
|
||||
$this->load_global_css();
|
||||
|
||||
$this->load_form();
|
||||
|
||||
$this->load_modal();
|
||||
|
||||
$this->load_dashboard();
|
||||
|
||||
$this->load_field();
|
||||
|
||||
$this->load_users_js();
|
||||
|
||||
$this->load_builder();
|
||||
|
||||
$this->load_redux_css();
|
||||
|
||||
$this->load_css();
|
||||
|
||||
$this->load_core_wp();
|
||||
|
||||
$this->load_ajax_js();
|
||||
|
||||
$this->load_custom_scripts();
|
||||
$ultimatemember->styles->wp_enqueue_scripts();
|
||||
|
||||
$this->load_global_css();
|
||||
$this->load_form();
|
||||
$this->load_modal();
|
||||
$this->load_dashboard();
|
||||
$this->load_field();
|
||||
$this->load_users_js();
|
||||
$this->load_builder();
|
||||
$this->load_redux_css();
|
||||
$this->load_css();
|
||||
$this->load_core_wp();
|
||||
$this->load_ajax_js();
|
||||
$this->load_custom_scripts();
|
||||
|
||||
} else if ( isset( $post->post_type ) ) {
|
||||
|
||||
$ultimatemember->styles->wp_enqueue_scripts();
|
||||
|
||||
$this->load_global_css();
|
||||
$this->load_css();
|
||||
$this->load_custom_scripts();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,35 +7,21 @@
|
||||
<div class="um-admin-dash-head-logo">
|
||||
<h2>Dashboard</h2>
|
||||
<span><?php echo ultimatemember_version; ?></span>
|
||||
</div>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
|
||||
</div><div class="um-admin-clear"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-dash-body">
|
||||
|
||||
<div class="um-admin-dash-nav">
|
||||
|
||||
<a href="#" class="active" data-rel="overview"><span class="um-admin-dash-nav-title">Dashboard Overview</span></a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="um-admin-dash-main">
|
||||
|
||||
<?php $tabs = array('overview'); ?>
|
||||
<div class="um-admin-dash-content">
|
||||
|
||||
<?php foreach( $tabs as $tab ) { ?>
|
||||
<div class="um-admin-dash-content" id="<?php echo $tab; ?>">
|
||||
|
||||
<?php include_once um_path . 'admin/templates/dashboard/'. $tab . '.php'; ?>
|
||||
|
||||
<?php include_once um_path . 'admin/templates/dashboard/overview.php'; ?>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-admin-clear"></div>
|
||||
</div><div class="um-admin-clear"></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,8 +1,26 @@
|
||||
<?php
|
||||
|
||||
/***
|
||||
*** @after user uploads, clean up uploads dir
|
||||
***/
|
||||
add_action('um_after_user_upload','um_remove_unused_uploads', 10);
|
||||
function um_remove_unused_uploads( $user_id ) {
|
||||
global $ultimatemember;
|
||||
um_fetch_user( $user_id );
|
||||
$array = $ultimatemember->user->profile;
|
||||
$files = glob( um_user_uploads_dir() . '*', GLOB_BRACE);
|
||||
foreach($files as $file) {
|
||||
$str = basename($file);
|
||||
if ( !strstr( $str, 'profile_photo') && !strstr( $str, 'cover_photo') && !preg_grep('/' . $str . '/', $array ) )
|
||||
unlink( $file );
|
||||
}
|
||||
um_reset_user();
|
||||
}
|
||||
|
||||
/***
|
||||
*** @listen to a new user creation in backend
|
||||
***/
|
||||
add_action( 'user_register', 'um_new_user_via_wpadmin', 10, 1 );
|
||||
function um_new_user_via_wpadmin( $user_id ) {
|
||||
|
||||
if ( is_admin() ) {
|
||||
@@ -21,5 +39,4 @@
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'user_register', 'um_new_user_via_wpadmin', 10, 1 );
|
||||
}
|
||||
+3
-8
@@ -502,15 +502,10 @@ class UM_Files {
|
||||
rmdir( $dir );
|
||||
|
||||
// update user's meta
|
||||
$existing = get_user_meta( $user_id, $key, true );
|
||||
if ( $existing ) {
|
||||
$file = basename( $existing );
|
||||
if ( $file != $filename ) {
|
||||
$delete_src = $this->upload_basedir . $user_id . '/' . basename( $existing );
|
||||
unlink( $delete_src );
|
||||
}
|
||||
}
|
||||
update_user_meta( $user_id, $key, $filename );
|
||||
|
||||
// this action is executed after upload
|
||||
do_action('um_after_user_upload', $user_id );
|
||||
|
||||
// the url of upload
|
||||
return $this->upload_baseurl . $user_id . '/' . $filename;
|
||||
|
||||
+351
-202
@@ -1,17 +1,34 @@
|
||||
<?php
|
||||
|
||||
/***
|
||||
*** @Get user IP
|
||||
***/
|
||||
function um_user_ip() {
|
||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||
return $_SERVER['HTTP_CLIENT_IP'];
|
||||
/**
|
||||
* @function um_user_ip()
|
||||
*
|
||||
* @description This function returns the IP address of user.
|
||||
*
|
||||
* @usage <?php $user_ip = um_user_ip(); ?>
|
||||
*
|
||||
* @returns Returns the user's IP address.
|
||||
*
|
||||
* @example The example below can retrieve the user's IP address
|
||||
|
||||
} else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
return $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
}
|
||||
return $_SERVER['REMOTE_ADDR'];
|
||||
<?php
|
||||
|
||||
$user_ip = um_user_ip();
|
||||
echo 'User IP address is: ' . $user_ip; // prints the user IP address e.g. 127.0.0.1
|
||||
|
||||
?>
|
||||
|
||||
*
|
||||
*
|
||||
*/
|
||||
function um_user_ip() {
|
||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
||||
return $_SERVER['HTTP_CLIENT_IP'];
|
||||
} else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
return $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
}
|
||||
return $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
|
||||
/***
|
||||
*** @If conditions are met return true;
|
||||
@@ -144,19 +161,40 @@
|
||||
return $value;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @profile user ID
|
||||
***/
|
||||
function um_profile_id() {
|
||||
/**
|
||||
* @function um_profile_id()
|
||||
*
|
||||
* @description This function returns the user ID for current profile.
|
||||
*
|
||||
* @usage <?php $user_id = um_profile_id(); ?>
|
||||
*
|
||||
* @returns Returns the user ID of profile if found, or current user ID if user is logged in. Also returns blank
|
||||
if no user ID is set.
|
||||
*
|
||||
* @example The example below will retrieve the user ID when viewing someone profile.
|
||||
|
||||
<?php
|
||||
|
||||
if ( um_get_requested_user() ) {
|
||||
return um_get_requested_user();
|
||||
} else if ( is_user_logged_in() && get_current_user_id() ) {
|
||||
return get_current_user_id();
|
||||
$user_id = um_profile_id();
|
||||
if ( $user_id == 1 ) {
|
||||
echo 'This is administrator profile.';
|
||||
}
|
||||
|
||||
return 0;
|
||||
?>
|
||||
|
||||
*
|
||||
*
|
||||
*/
|
||||
function um_profile_id() {
|
||||
|
||||
if ( um_get_requested_user() ) {
|
||||
return um_get_requested_user();
|
||||
} else if ( is_user_logged_in() && get_current_user_id() ) {
|
||||
return get_current_user_id();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Check that temp upload is valid
|
||||
@@ -346,21 +384,49 @@
|
||||
return $ultimatemember->members->results[ $argument ];
|
||||
}
|
||||
|
||||
/***
|
||||
*** @reset user clean
|
||||
***/
|
||||
function um_reset_user_clean() {
|
||||
global $ultimatemember;
|
||||
$ultimatemember->user->reset( true );
|
||||
}
|
||||
/**
|
||||
* @function um_reset_user_clean()
|
||||
*
|
||||
* @description This function is similar to um_reset_user() with a difference that it will not use the logged-in user
|
||||
data after resetting. It is a hard-reset function for all user data.
|
||||
*
|
||||
* @usage <?php um_reset_user_clean(); ?>
|
||||
*
|
||||
* @returns Clears the user data. You need to fetch a user manually after using this function.
|
||||
*
|
||||
* @example You can reset user data by using the following line in your code
|
||||
|
||||
<?php um_reset_user_clean(); ?>
|
||||
|
||||
*
|
||||
*
|
||||
*/
|
||||
function um_reset_user_clean() {
|
||||
global $ultimatemember;
|
||||
$ultimatemember->user->reset( true );
|
||||
}
|
||||
|
||||
/***
|
||||
*** @reset user
|
||||
***/
|
||||
function um_reset_user() {
|
||||
global $ultimatemember;
|
||||
$ultimatemember->user->reset();
|
||||
}
|
||||
/**
|
||||
* @function um_reset_user()
|
||||
*
|
||||
* @description This function resets the current user. You can use it to reset user data after
|
||||
retrieving the details of a specific user.
|
||||
*
|
||||
* @usage <?php um_reset_user(); ?>
|
||||
*
|
||||
* @returns Clears the user data. If a user is logged in, the user data will be reset to that user's data
|
||||
*
|
||||
* @example You can reset user data by using the following line in your code
|
||||
|
||||
<?php um_reset_user(); ?>
|
||||
|
||||
*
|
||||
*
|
||||
*/
|
||||
function um_reset_user() {
|
||||
global $ultimatemember;
|
||||
$ultimatemember->user->reset();
|
||||
}
|
||||
|
||||
/***
|
||||
*** @gets the queried user
|
||||
@@ -479,7 +545,10 @@
|
||||
***/
|
||||
function um_can_edit_field( $data ) {
|
||||
global $ultimatemember;
|
||||
if ( $ultimatemember->fields->editing == true && $ultimatemember->fields->set_mode == 'profile' ) {
|
||||
|
||||
if ( isset( $ultimatemember->fields->editing ) && $ultimatemember->fields->editing == true &&
|
||||
isset( $ultimatemember->fields->set_mode ) && $ultimatemember->fields->set_mode == 'profile' ) {
|
||||
|
||||
if ( is_user_logged_in() && isset( $data['editable'] ) && $data['editable'] == 0 ) {
|
||||
|
||||
if ( um_is_user_himself() && !um_user('can_edit_everyone') )
|
||||
@@ -489,8 +558,11 @@
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -567,29 +639,49 @@
|
||||
return um_get_option('admin_email');
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Gets an option from DB
|
||||
***/
|
||||
function um_get_option($option_id) {
|
||||
global $ultimatemember;
|
||||
$um_options = $ultimatemember->options;
|
||||
if ( isset($um_options[$option_id]) && !empty( $um_options[$option_id] ) ) {
|
||||
return $um_options[$option_id];
|
||||
}
|
||||
|
||||
switch($option_id){
|
||||
|
||||
case 'site_name':
|
||||
return get_bloginfo('name');
|
||||
break;
|
||||
|
||||
case 'admin_email':
|
||||
return get_bloginfo('admin_email');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @function um_get_option()
|
||||
*
|
||||
* @description This function returns the value of an option or setting.
|
||||
*
|
||||
* @usage <?php $value = um_get_option( $setting ); ?>
|
||||
*
|
||||
* @param $option_id (string) (required) The option or setting that you want to retrieve
|
||||
*
|
||||
* @returns Returns the value of the setting you requested, or a blank value if the setting
|
||||
does not exist.
|
||||
*
|
||||
* @example Get default user role set in global options
|
||||
|
||||
<?php $default_role = um_get_option('default_role'); ?>
|
||||
|
||||
*
|
||||
* @example Get blocked IP addresses set in backend
|
||||
|
||||
<?php $blocked_ips = um_get_option('blocked_ips'); ?>
|
||||
|
||||
*
|
||||
*/
|
||||
function um_get_option($option_id) {
|
||||
global $ultimatemember;
|
||||
$um_options = $ultimatemember->options;
|
||||
if ( isset($um_options[$option_id]) && !empty( $um_options[$option_id] ) ) {
|
||||
return $um_options[$option_id];
|
||||
}
|
||||
|
||||
switch($option_id){
|
||||
|
||||
case 'site_name':
|
||||
return get_bloginfo('name');
|
||||
break;
|
||||
|
||||
case 'admin_email':
|
||||
return get_bloginfo('admin_email');
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Display a link to profile page
|
||||
@@ -607,13 +699,42 @@
|
||||
return $ultimatemember->query->get_roles();
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Sets up a user profile by ID
|
||||
***/
|
||||
function um_fetch_user( $user_id ) {
|
||||
global $ultimatemember;
|
||||
$ultimatemember->user->set( $user_id );
|
||||
}
|
||||
/**
|
||||
* @function um_fetch_user()
|
||||
*
|
||||
* @description This function sets a user and allow you to retrieve any information for the retrieved user
|
||||
*
|
||||
* @usage <?php um_fetch_user( $user_id ); ?>
|
||||
*
|
||||
* @param $user_id (numeric) (required) A user ID is required. This is the user's ID that you wish to set/retrieve
|
||||
*
|
||||
* @returns Sets a specific user and prepares profile data and user permissions and makes them accessible.
|
||||
*
|
||||
* @example The example below will set user ID 5 prior to retrieving his profile information.
|
||||
|
||||
<?php
|
||||
|
||||
um_fetch_user(5);
|
||||
echo um_user('display_name'); // returns the display name of user ID 5
|
||||
|
||||
?>
|
||||
|
||||
*
|
||||
* @example In the following example you can fetch the profile of a logged-in user dynamically.
|
||||
|
||||
<?php
|
||||
|
||||
um_fetch_user( get_current_user_id() );
|
||||
echo um_user('display_name'); // returns the display name of logged-in user
|
||||
|
||||
?>
|
||||
|
||||
*
|
||||
*/
|
||||
function um_fetch_user( $user_id ) {
|
||||
global $ultimatemember;
|
||||
$ultimatemember->user->set( $user_id );
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Load profile key
|
||||
@@ -724,164 +845,192 @@
|
||||
return '';
|
||||
}
|
||||
|
||||
/***
|
||||
*** @get user data
|
||||
***/
|
||||
function um_user( $data, $attrs = null ) {
|
||||
global $ultimatemember;
|
||||
/**
|
||||
* @function um_user()
|
||||
*
|
||||
* @description This function can be used to get user's data. This can be user profile data or user permissions.
|
||||
*
|
||||
* @usage <?php echo um_user( $data ); ?>
|
||||
*
|
||||
* @param $data (string) (required) The field or data you want to retrieve for user.
|
||||
* @param $attrs (string) (optional) Additional attribute for profile data that may need extra configuration.
|
||||
*
|
||||
* @returns Returns the user data requested If found. A user must be previously set using um_fetch_user() to
|
||||
properly retrieve user data.
|
||||
*
|
||||
* @example The example below can retrieve the user's display name
|
||||
|
||||
<?php
|
||||
|
||||
$display_name = um_user('display_name');
|
||||
echo $display_name; // prints the user's display name
|
||||
|
||||
switch($data){
|
||||
?>
|
||||
|
||||
*
|
||||
* @example The example below can retrieve user's community role
|
||||
|
||||
<?php echo um_user('role_name'); // example: Member or Admin ?>
|
||||
|
||||
*
|
||||
*/
|
||||
function um_user( $data, $attrs = null ) {
|
||||
|
||||
global $ultimatemember;
|
||||
|
||||
default:
|
||||
switch($data){
|
||||
|
||||
default:
|
||||
|
||||
$value = um_profile($data);
|
||||
$value = um_profile($data);
|
||||
|
||||
if ( $ultimatemember->validation->is_serialized( $value ) ) {
|
||||
$value = unserialize( $value );
|
||||
}
|
||||
if ( $ultimatemember->validation->is_serialized( $value ) ) {
|
||||
$value = unserialize( $value );
|
||||
}
|
||||
|
||||
return $value;
|
||||
return $value;
|
||||
break;
|
||||
|
||||
break;
|
||||
case 'full_name':
|
||||
|
||||
if ( !um_profile( $data ) ) {
|
||||
|
||||
case 'full_name':
|
||||
if ( !um_profile( $data ) ) {
|
||||
|
||||
if ( um_user('first_name') && um_user('last_name') ) {
|
||||
$full_name = um_user('first_name') . '.' . um_user('last_name');
|
||||
} else {
|
||||
$full_name = um_user('display_name');
|
||||
}
|
||||
|
||||
$full_name = $ultimatemember->validation->safe_name_in_url( $full_name );
|
||||
update_user_meta( um_user('ID'), 'full_name', $full_name );
|
||||
|
||||
return $full_name;
|
||||
|
||||
if ( um_user('first_name') && um_user('last_name') ) {
|
||||
$full_name = um_user('first_name') . '.' . um_user('last_name');
|
||||
} else {
|
||||
|
||||
return um_profile( $data );
|
||||
$full_name = um_user('display_name');
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 'display_name':
|
||||
|
||||
$op = um_get_option('display_name');
|
||||
|
||||
if ( $op == 'full_name' ) {
|
||||
if ( um_user('first_name') && um_user('last_name') ) {
|
||||
return um_user('first_name') . ' ' . um_user('last_name');
|
||||
} else {
|
||||
return um_profile( $data );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $op == 'sur_name' ) {
|
||||
if ( um_user('first_name') && um_user('last_name') ) {
|
||||
return um_user('last_name') . ', ' . um_user('first_name');
|
||||
} else {
|
||||
return um_profile( $data );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $op == 'first_name' ) {
|
||||
if ( um_user('first_name') ) {
|
||||
return um_user('first_name');
|
||||
} else {
|
||||
return um_profile( $data );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $op == 'username' ) {
|
||||
return um_user('user_login');
|
||||
}
|
||||
|
||||
if ( $op == 'initial_name' ) {
|
||||
if ( um_user('first_name') && um_user('last_name') ) {
|
||||
$initial = um_user('last_name');
|
||||
return um_user('first_name') . ' ' . $initial[0];
|
||||
} else {
|
||||
return um_profile( $data );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $op == 'initial_name_f' ) {
|
||||
if ( um_user('first_name') && um_user('last_name') ) {
|
||||
$initial = um_user('first_name');
|
||||
return $initial[0] . ' ' . um_user('last_name');
|
||||
} else {
|
||||
return um_profile( $data );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $op == 'public_name' ) {
|
||||
return um_profile( $data );
|
||||
}
|
||||
|
||||
if ( $op == 'field' && um_get_option('display_name_field') != '' ) {
|
||||
$fields = array_filter(preg_split('/[,\s]+/', um_get_option('display_name_field') ));
|
||||
$output = '';
|
||||
foreach( $fields as $field ) {
|
||||
$output .= um_profile( $field ) . ' ';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
$full_name = $ultimatemember->validation->safe_name_in_url( $full_name );
|
||||
update_user_meta( um_user('ID'), 'full_name', $full_name );
|
||||
|
||||
return $full_name;
|
||||
|
||||
} else {
|
||||
|
||||
return um_profile( $data );
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
case 'display_name':
|
||||
|
||||
$op = um_get_option('display_name');
|
||||
|
||||
case 'role_select':
|
||||
case 'role_radio':
|
||||
return um_user('role_name');
|
||||
break;
|
||||
|
||||
case 'submitted':
|
||||
$array = um_profile($data);
|
||||
if ( empty( $array ) ) return '';
|
||||
$array = unserialize( $array );
|
||||
return $array;
|
||||
break;
|
||||
|
||||
case 'password_reset_link':
|
||||
return $ultimatemember->password->reset_url();
|
||||
break;
|
||||
|
||||
case 'account_activation_link':
|
||||
return $ultimatemember->permalinks->activate_url();
|
||||
break;
|
||||
|
||||
case 'profile_photo':
|
||||
|
||||
if ( um_profile('profile_photo') ) {
|
||||
$avatar_uri = um_get_avatar_uri( um_profile('profile_photo'), $attrs );
|
||||
if ( $op == 'full_name' ) {
|
||||
if ( um_user('first_name') && um_user('last_name') ) {
|
||||
return um_user('first_name') . ' ' . um_user('last_name');
|
||||
} else {
|
||||
$avatar_uri = um_get_default_avatar_uri();
|
||||
return um_profile( $data );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $avatar_uri )
|
||||
return '<img src="' . $avatar_uri . '" class="gravatar avatar avatar-'.$attrs.' um-avatar" width="'.$attrs.'" height="'.$attrs.'" alt="" />';
|
||||
|
||||
if ( !$avatar_uri )
|
||||
return '';
|
||||
|
||||
break;
|
||||
|
||||
case 'cover_photo':
|
||||
if ( um_profile('cover_photo') ) {
|
||||
$cover_uri = um_get_cover_uri( um_profile('cover_photo'), $attrs );
|
||||
if ( $op == 'sur_name' ) {
|
||||
if ( um_user('first_name') && um_user('last_name') ) {
|
||||
return um_user('last_name') . ', ' . um_user('first_name');
|
||||
} else {
|
||||
$cover_uri = um_get_default_cover_uri();
|
||||
return um_profile( $data );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $cover_uri )
|
||||
return '<img src="'. $cover_uri .'" alt="" />';
|
||||
if ( $op == 'first_name' ) {
|
||||
if ( um_user('first_name') ) {
|
||||
return um_user('first_name');
|
||||
} else {
|
||||
return um_profile( $data );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$cover_uri )
|
||||
return '';
|
||||
if ( $op == 'username' ) {
|
||||
return um_user('user_login');
|
||||
}
|
||||
|
||||
break;
|
||||
if ( $op == 'initial_name' ) {
|
||||
if ( um_user('first_name') && um_user('last_name') ) {
|
||||
$initial = um_user('last_name');
|
||||
return um_user('first_name') . ' ' . $initial[0];
|
||||
} else {
|
||||
return um_profile( $data );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if ( $op == 'initial_name_f' ) {
|
||||
if ( um_user('first_name') && um_user('last_name') ) {
|
||||
$initial = um_user('first_name');
|
||||
return $initial[0] . ' ' . um_user('last_name');
|
||||
} else {
|
||||
return um_profile( $data );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $op == 'public_name' ) {
|
||||
return um_profile( $data );
|
||||
}
|
||||
|
||||
if ( $op == 'field' && um_get_option('display_name_field') != '' ) {
|
||||
$fields = array_filter(preg_split('/[,\s]+/', um_get_option('display_name_field') ));
|
||||
$output = '';
|
||||
foreach( $fields as $field ) {
|
||||
$output .= um_profile( $field ) . ' ';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
return um_profile( $data );
|
||||
|
||||
break;
|
||||
|
||||
case 'role_select':
|
||||
case 'role_radio':
|
||||
return um_user('role_name');
|
||||
break;
|
||||
|
||||
case 'submitted':
|
||||
$array = um_profile($data);
|
||||
if ( empty( $array ) ) return '';
|
||||
$array = unserialize( $array );
|
||||
return $array;
|
||||
break;
|
||||
|
||||
case 'password_reset_link':
|
||||
return $ultimatemember->password->reset_url();
|
||||
break;
|
||||
|
||||
case 'account_activation_link':
|
||||
return $ultimatemember->permalinks->activate_url();
|
||||
break;
|
||||
|
||||
case 'profile_photo':
|
||||
|
||||
if ( um_profile('profile_photo') ) {
|
||||
$avatar_uri = um_get_avatar_uri( um_profile('profile_photo'), $attrs );
|
||||
} else {
|
||||
$avatar_uri = um_get_default_avatar_uri();
|
||||
}
|
||||
|
||||
if ( $avatar_uri )
|
||||
return '<img src="' . $avatar_uri . '" class="gravatar avatar avatar-'.$attrs.' um-avatar" width="'.$attrs.'" height="'.$attrs.'" alt="" />';
|
||||
|
||||
if ( !$avatar_uri )
|
||||
return '';
|
||||
|
||||
break;
|
||||
|
||||
case 'cover_photo':
|
||||
if ( um_profile('cover_photo') ) {
|
||||
$cover_uri = um_get_cover_uri( um_profile('cover_photo'), $attrs );
|
||||
} else {
|
||||
$cover_uri = um_get_default_cover_uri();
|
||||
}
|
||||
|
||||
if ( $cover_uri )
|
||||
return '<img src="'. $cover_uri .'" alt="" />';
|
||||
|
||||
if ( !$cover_uri )
|
||||
return '';
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+3
-2
@@ -26,10 +26,11 @@ class UM_User {
|
||||
'user_email',
|
||||
'user_pass',
|
||||
'user_password',
|
||||
'display_name',
|
||||
);
|
||||
|
||||
$this->target_id = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -127,7 +128,7 @@ class UM_User {
|
||||
foreach($this->usermeta as $k=>$v){
|
||||
$this->profile[$k] = $v[0];
|
||||
}
|
||||
|
||||
|
||||
// add user stuff
|
||||
$this->profile['post_count'] = $ultimatemember->query->count_posts($this->id);
|
||||
$this->profile['comment_count'] = $ultimatemember->query->count_comments($this->id);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Plugin Name: Ultimate Member
|
||||
Plugin URI: http://ultimatemember.com/
|
||||
Description: Ultimate Member is a powerful community and membership plugin that allows you to create beautiful community and membership sites with WordPress
|
||||
Version: 1.0.43
|
||||
Version: 1.0.44
|
||||
Author: Ultimate Member
|
||||
Author URI: http://ultimatemember.com/
|
||||
*/
|
||||
|
||||
+9
-1
@@ -7,7 +7,7 @@ Tags: access control, author, authors, author profile, comments, community, comm
|
||||
Requires at least: 4.1
|
||||
Tested up to: 4.1
|
||||
|
||||
Stable Tag: 1.0.43
|
||||
Stable Tag: 1.0.44
|
||||
|
||||
License: GNU Version 2 or Any Later Version
|
||||
|
||||
@@ -185,6 +185,14 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.0.44: February 8, 2015 =
|
||||
|
||||
* Tweak: improved performance: unused user photos are deleted when user upload
|
||||
* Tweak: cleaned up dashboard code
|
||||
* Tweak: updated current translations
|
||||
* Fixed: display name field should be updated with wp_update_user and not in usermeta
|
||||
* Fixed: admin js and css should are loaded in UM backend only
|
||||
|
||||
= 1.0.43: February 7, 2015 =
|
||||
|
||||
* New: added German (Deutsch) language support
|
||||
|
||||
Reference in New Issue
Block a user