mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Sync Up-to-date
This commit is contained in:
@@ -73,7 +73,7 @@
|
||||
|
||||
.um-account-name a {
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
color: #555;
|
||||
text-decoration: none !important;
|
||||
font-size: 18px;
|
||||
}
|
||||
@@ -168,7 +168,7 @@
|
||||
float: left;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
color: #444;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.um-account-side li a:hover {color: #444; background: #ddd}
|
||||
|
||||
+72
-66
@@ -1,5 +1,75 @@
|
||||
<?php
|
||||
|
||||
/***
|
||||
*** @update user's profile
|
||||
***/
|
||||
add_action('um_user_edit_profile', 'um_user_edit_profile', 10);
|
||||
function um_user_edit_profile($args){
|
||||
|
||||
global $ultimatemember;
|
||||
|
||||
$to_update = null;
|
||||
$files = null;
|
||||
|
||||
if ( isset( $args['user_id'] ) ) {
|
||||
if ( um_current_user_can('edit', $args['user_id'] ) ) {
|
||||
$ultimatemember->user->set( $args['user_id'] );
|
||||
} else {
|
||||
wp_die( __('You are not allowed to edit this user.','ultimatemember') );
|
||||
}
|
||||
} else if ( isset( $args['_user_id'] ) ) {
|
||||
$ultimatemember->user->set( $args['_user_id'] );
|
||||
}
|
||||
|
||||
$userinfo = $ultimatemember->user->profile;
|
||||
|
||||
$fields = unserialize( $args['custom_fields'] );
|
||||
|
||||
do_action('um_user_before_updating_profile', $userinfo );
|
||||
|
||||
// loop through fields
|
||||
foreach( $fields as $key => $array ) {
|
||||
|
||||
if ( $fields[$key]['type'] == 'multiselect' || $fields[$key]['type'] == 'checkbox' && !isset($args['submitted'][$key]) ) {
|
||||
delete_user_meta( um_user('ID'), $key );
|
||||
}
|
||||
|
||||
if ( isset( $args['submitted'][ $key ] ) ) {
|
||||
|
||||
if ( isset( $userinfo[$key]) && $args['submitted'][$key] != $userinfo[$key] ) {
|
||||
$to_update[ $key ] = $args['submitted'][ $key ];
|
||||
} else if ( $args['submitted'][$key] ) {
|
||||
$to_update[ $key ] = $args['submitted'][ $key ];
|
||||
}
|
||||
|
||||
// files
|
||||
if ( isset( $fields[$key]['type'] ) && in_array( $fields[$key]['type'], array('image','file') ) && um_is_temp_upload( $args['submitted'][ $key ] ) ) {
|
||||
$files[ $key ] = $args['submitted'][ $key ];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $args['submitted']['description'] ) ) {
|
||||
$to_update['description'] = $ultimatemember->validation->remove_html( $args['submitted']['description'] );
|
||||
}
|
||||
|
||||
if ( is_array( $to_update ) ) {
|
||||
$ultimatemember->user->update_profile( $to_update );
|
||||
}
|
||||
|
||||
if ( is_array( $files ) ) {
|
||||
$ultimatemember->user->update_files( $files );
|
||||
}
|
||||
|
||||
do_action('um_user_after_updating_profile', $to_update );
|
||||
|
||||
if ( !isset( $args['is_signup'] ) ) {
|
||||
exit( wp_redirect( um_edit_my_profile_cancel_uri() ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @if editing another user
|
||||
***/
|
||||
@@ -295,6 +365,7 @@
|
||||
$items = array(
|
||||
'editprofile' => '<a href="'.um_edit_my_profile_uri().'" class="real_url">'.__('Edit Profile','ultimatemember').'</a>',
|
||||
'myaccount' => '<a href="'.um_get_core_page('account').'" class="real_url">'.__('My Account','ultimatemember').'</a>',
|
||||
'logout' => '<a href="'.um_get_core_page('logout').'" class="real_url">'.__('Logout','ultimatemember').'</a>',
|
||||
'cancel' => '<a href="#" class="um-dropdown-hide">'.__('Cancel','ultimatemember').'</a>',
|
||||
);
|
||||
|
||||
@@ -305,6 +376,7 @@
|
||||
$actions = $ultimatemember->user->get_admin_actions();
|
||||
|
||||
unset( $items['myaccount'] );
|
||||
unset( $items['logout'] );
|
||||
unset( $items['cancel'] );
|
||||
$items = array_merge( $items, $actions );
|
||||
$items['cancel'] = $cancel;
|
||||
@@ -328,72 +400,6 @@
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @update user's profile
|
||||
***/
|
||||
add_action('um_user_edit_profile', 'um_user_edit_profile', 10);
|
||||
function um_user_edit_profile($args){
|
||||
|
||||
global $ultimatemember;
|
||||
|
||||
$to_update = null;
|
||||
$files = null;
|
||||
|
||||
if ( isset( $args['user_id'] ) ) {
|
||||
if ( um_current_user_can('edit', $args['user_id'] ) ) {
|
||||
$ultimatemember->user->set( $args['user_id'] );
|
||||
} else {
|
||||
wp_die( __('You are not allowed to edit this user.','ultimatemember') );
|
||||
}
|
||||
}
|
||||
|
||||
$userinfo = $ultimatemember->user->profile;
|
||||
|
||||
$fields = unserialize( $args['custom_fields'] );
|
||||
|
||||
do_action('um_user_before_updating_profile', $userinfo );
|
||||
|
||||
// loop through fields
|
||||
foreach( $fields as $key => $array ) {
|
||||
|
||||
if ( $fields[$key]['type'] == 'multiselect' || $fields[$key]['type'] == 'checkbox' && !isset($args['submitted'][$key]) ) {
|
||||
delete_user_meta( um_user('ID'), $key );
|
||||
}
|
||||
|
||||
if ( isset( $args['submitted'][ $key ] ) ) {
|
||||
|
||||
if ( isset( $userinfo[$key]) && $args['submitted'][$key] != $userinfo[$key] ) {
|
||||
$to_update[ $key ] = $args['submitted'][ $key ];
|
||||
} else if ( $args['submitted'][$key] ) {
|
||||
$to_update[ $key ] = $args['submitted'][ $key ];
|
||||
}
|
||||
|
||||
// files
|
||||
if ( isset( $fields[$key]['type'] ) && in_array( $fields[$key]['type'], array('image','file') ) && um_is_temp_upload( $args['submitted'][ $key ] ) ) {
|
||||
$files[ $key ] = $args['submitted'][ $key ];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $args['submitted']['description'] ) ) {
|
||||
$to_update['description'] = $ultimatemember->validation->remove_html( $args['submitted']['description'] );
|
||||
}
|
||||
|
||||
if ( is_array( $to_update ) ) {
|
||||
$ultimatemember->user->update_profile( $to_update );
|
||||
}
|
||||
|
||||
if ( is_array( $files ) ) {
|
||||
$ultimatemember->user->update_files( $files );
|
||||
}
|
||||
|
||||
do_action('um_user_after_updating_profile', $to_update );
|
||||
|
||||
exit( wp_redirect( um_edit_my_profile_cancel_uri() ) );
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Show Fields
|
||||
***/
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
$unique_userID = $ultimatemember->query->count_users() + 1;
|
||||
|
||||
if( !isset($user_email) ) {
|
||||
$user_email = 'nobody' . $unique_userID . '@' . bloginfo('name');
|
||||
$user_email = 'nobody' . $unique_userID . '@' . get_bloginfo('name');
|
||||
}
|
||||
|
||||
if ( !isset( $user_login ) ) {
|
||||
@@ -91,12 +91,29 @@
|
||||
|
||||
$ultimatemember->user->set_registration_details( $args['submitted'] );
|
||||
|
||||
do_action('um_post_registration_save', $user_id, $args);
|
||||
|
||||
do_action('um_post_registration_listener', $user_id, $args);
|
||||
|
||||
do_action('um_post_registration', $user_id, $args);
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Update user's profile after registration
|
||||
***/
|
||||
add_action('um_post_registration_save', 'um_post_registration_save', 10, 2);
|
||||
function um_post_registration_save($user_id, $args){
|
||||
global $ultimatemember;
|
||||
|
||||
unset( $args['user_id'] );
|
||||
$args['_user_id'] = $user_id;
|
||||
$args['is_signup'] = 1;
|
||||
|
||||
do_action('um_user_edit_profile', $args);
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @post-registration admin listender
|
||||
***/
|
||||
|
||||
@@ -170,9 +170,7 @@ class UM_Setup {
|
||||
'core' => 'admin',
|
||||
'can_access_wpadmin' => 1,
|
||||
'can_edit_everyone' => 1,
|
||||
'can_edit_roles' => 1,
|
||||
'can_delete_everyone' => 1,
|
||||
'can_delete_roles' => 1,
|
||||
'can_edit_profile' => 1,
|
||||
'can_delete_profile' => 1,
|
||||
'can_view_all' => 1,
|
||||
@@ -190,9 +188,7 @@ class UM_Setup {
|
||||
'core' => 'member',
|
||||
'can_access_wpadmin' => 0,
|
||||
'can_edit_everyone' => 0,
|
||||
'can_edit_roles' => 0,
|
||||
'can_delete_everyone' => 0,
|
||||
'can_delete_roles' => 0,
|
||||
'can_make_private_profile' => 0,
|
||||
'can_access_private_profile' => 0,
|
||||
'after_login' => 'redirect_profile',
|
||||
|
||||
+2
-8
@@ -198,12 +198,6 @@ class UM_User {
|
||||
***/
|
||||
function set_status( $status ){
|
||||
|
||||
$old_status = ( isset( $this->profile['account_status'] ) ) ? $this->profile['account_status'] : 'null';
|
||||
|
||||
if ( $status == $old_status ) return; // to prevent spam
|
||||
|
||||
do_action('um_before_user_status_is_changed', $old_status );
|
||||
|
||||
$this->profile['account_status'] = $status;
|
||||
|
||||
$this->update_usermeta_info('account_status');
|
||||
@@ -423,11 +417,11 @@ class UM_User {
|
||||
/***
|
||||
*** @update files
|
||||
***/
|
||||
function update_files( $array ) {
|
||||
function update_files( $changes ) {
|
||||
|
||||
global $ultimatemember;
|
||||
|
||||
foreach( $array as $key => $uri ) {
|
||||
foreach( $changes as $key => $uri ) {
|
||||
$src = um_is_temp_upload( $uri );
|
||||
$ultimatemember->files->new_user_upload( $this->id, $src, $key );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user