- small code formatting;

This commit is contained in:
nikitasinelnikov
2020-03-02 16:47:56 +02:00
parent 0aab9853d9
commit 72a1e9a7c3
12 changed files with 59 additions and 56 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
/**
* Set value on form submission
*/
if( isset( $_REQUEST[ $id ] ) ){
if ( isset( $_REQUEST[ $id ] ) ) {
$checked = $_REQUEST[ $id ];
}
+2 -2
View File
@@ -361,7 +361,7 @@ if ( ! class_exists( 'um\core\Files' ) ) {
$id = $_POST['key'];
$timestamp = $_POST['timestamp'];
$nonce = $_POST['_wpnonce'];
$user_id = empty( $_POST['user_id'] ) ? get_current_user_id() : $_POST['user_id'];
$user_id = empty( $_POST['user_id'] ) ? get_current_user_id() : absint( $_POST['user_id'] );
UM()->fields()->set_id = $_POST['set_id'];
UM()->fields()->set_mode = $_POST['set_mode'];
@@ -481,7 +481,7 @@ if ( ! class_exists( 'um\core\Files' ) ) {
if ( ! is_array( $_FILES[ $id ]['name'] ) ) {
$user_id = $_POST['user_id'];
$user_id = absint( $_POST['user_id'] );
UM()->uploader()->replace_upload_dir = true;
$uploaded = UM()->uploader()->upload_file( $_FILES[ $id ], $user_id, $id );
+5 -5
View File
@@ -156,7 +156,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
);
}
if ( isset( $_POST['child_callback'] ) && ! empty( $_POST['child_callback'] ) && isset( $form_fields[ $_POST['child_name'] ] ) ){
if ( ! empty( $_POST['child_callback'] ) && isset( $form_fields[ $_POST['child_name'] ] ) ) {
$ajax_source_func = $_POST['child_callback'];
@@ -167,13 +167,13 @@ if ( ! class_exists( 'um\core\Form' ) ) {
$arr_options['field'] = $form_fields[ $_POST['child_name'] ];
if( function_exists( $ajax_source_func ) ){
$arr_options['items'] = call_user_func( $ajax_source_func, $arr_options['field']['parent_dropdown_relationship'] );
if ( function_exists( $ajax_source_func ) ) {
$arr_options['items'] = call_user_func( $ajax_source_func, $arr_options['field']['parent_dropdown_relationship'] );
}
} else {
$arr_options['status'] = 'error';
$arr_options['message'] = __( 'This is not possible for security reasons.','ultimate-member');
$arr_options['message'] = __( 'This is not possible for security reasons.', 'ultimate-member' );
}
}
@@ -335,7 +335,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
* }
* ?>
*/
do_action( "um_before_submit_form_post", $_POST );
do_action( 'um_before_submit_form_post', $_POST );
$this->form_id = $_POST['form_id'];
$this->form_status = get_post_status( $this->form_id );
+1 -1
View File
@@ -286,7 +286,7 @@ if ( ! class_exists( 'um\core\Password' ) ) {
$rp_cookie = 'wp-resetpass-' . COOKIEHASH;
if ( isset( $_GET['hash'] ) ) {
$userdata = get_userdata( wp_unslash( $_GET['user_id'] ) );
$userdata = get_userdata( wp_unslash( absint( $_GET['user_id'] ) ) );
if ( ! $userdata || is_wp_error( $userdata ) ) {
wp_redirect( add_query_arg( array( 'act' => 'reset_password', 'error' => 'invalidkey' ), get_permalink() ) );
exit;
+8 -7
View File
@@ -179,24 +179,25 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
* Activates an account via email
*/
function activate_account_via_email_link() {
if ( isset($_REQUEST['act']) && $_REQUEST['act'] == 'activate_via_email' && isset($_REQUEST['hash']) && is_string($_REQUEST['hash']) && strlen($_REQUEST['hash']) == 40 &&
isset($_REQUEST['user_id']) && is_numeric($_REQUEST['user_id']) ) { // valid token
if ( isset( $_REQUEST['act'] ) && $_REQUEST['act'] == 'activate_via_email' && isset( $_REQUEST['hash'] ) && is_string( $_REQUEST['hash'] ) && strlen( $_REQUEST['hash'] ) == 40 &&
isset( $_REQUEST['user_id'] ) && is_numeric( $_REQUEST['user_id'] ) ) { // valid token
$user_id = absint( $_REQUEST['user_id'] );
delete_option( "um_cache_userdata_{$user_id}" );
um_fetch_user( $user_id );
if ( strtolower($_REQUEST['hash']) !== strtolower( um_user('account_secret_hash') ) )
wp_die( __( 'This activation link is expired or have already been used.','ultimate-member' ) );
if ( strtolower( $_REQUEST['hash'] ) !== strtolower( um_user( 'account_secret_hash' ) ) ) {
wp_die( __( 'This activation link is expired or have already been used.', 'ultimate-member' ) );
}
UM()->user()->approve();
$redirect = ( um_user('url_email_activate') ) ? um_user('url_email_activate') : um_get_core_page('login', 'account_active');
$login = (bool) um_user('login_email_activate');
$redirect = ( um_user( 'url_email_activate' ) ) ? um_user( 'url_email_activate' ) : um_get_core_page( 'login', 'account_active' );
$login = (bool) um_user( 'login_email_activate' );
// log in automatically
if ( ! is_user_logged_in() && $login ) {
$user = get_userdata($user_id);
$user = get_userdata( $user_id );
$user_id = $user->ID;
// update wp user
+6 -6
View File
@@ -387,14 +387,14 @@ if ( ! class_exists( 'um\core\User' ) ) {
$args = array( 'fields' => 'ID', 'number' => 1 );
$args['meta_query']['relation'] = 'OR';
$args['meta_query'][] = array(
'key' => 'account_status',
'value' => 'awaiting_email_confirmation',
'compare' => '='
'key' => 'account_status',
'value' => 'awaiting_email_confirmation',
'compare' => '='
);
$args['meta_query'][] = array(
'key' => 'account_status',
'value' => 'awaiting_admin_review',
'compare' => '='
'key' => 'account_status',
'value' => 'awaiting_admin_review',
'compare' => '='
);
/**
+1 -1
View File
@@ -10,7 +10,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
function ultimatemember_check_username_exists() {
UM()->check_ajax_nonce();
$username = isset($_REQUEST['username']) ? $_REQUEST['username'] : '';
$username = isset( $_REQUEST['username'] ) ? $_REQUEST['username'] : '';
$exists = username_exists( $username );
/**
+4 -4
View File
@@ -18,7 +18,7 @@ function um_action_request_process() {
return;
}
if ( isset( $_REQUEST['uid'] ) && ! UM()->user()->user_exists_by_id( $_REQUEST['uid'] ) ) {
if ( isset( $_REQUEST['uid'] ) && ! UM()->user()->user_exists_by_id( absint( $_REQUEST['uid'] ) ) ) {
return;
}
@@ -32,13 +32,13 @@ function um_action_request_process() {
// wp_die( __( 'You do not have enough permissions to do that.','ultimate-member') );
// }
$uid = 0;
if ( isset( $_REQUEST['uid'] ) ) {
$uid = $_REQUEST['uid'];
$uid = absint( $_REQUEST['uid'] );
}
switch ( $_REQUEST['um_action'] ) {
default:
$uid = isset( $_REQUEST['uid'] ) ? $_REQUEST['uid'] : 0;
/**
* UM hook
*
@@ -80,7 +80,7 @@ function um_action_request_process() {
if ( ! current_user_can( 'delete_users' ) ) {
return;
}
UM()->user()->auto_login( $_REQUEST['uid'] );
UM()->user()->auto_login( $uid );
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
break;
+3 -3
View File
@@ -140,7 +140,7 @@ function um_submit_form_errors_hook_logincheck( $args ) {
}
if ( isset( $args['form_id'] ) && $args['form_id'] == UM()->shortcodes()->core_login_form() && UM()->form()->errors && ! isset( $_POST[ UM()->honeypot ] ) ) {
exit( wp_redirect( um_get_core_page('login') ) );
exit( wp_redirect( um_get_core_page( 'login' ) ) );
}
}
@@ -179,8 +179,8 @@ function um_user_login( $args ) {
$rememberme = ( isset( $args['rememberme'] ) && 1 == $args['rememberme'] && isset( $_REQUEST['rememberme'] ) ) ? 1 : 0;
if ( ( UM()->options()->get('deny_admin_frontend_login') && ! isset( $_GET['provider'] ) ) && strrpos( um_user('wp_roles' ), 'administrator' ) !== false ) {
wp_die( __('This action has been prevented for security measures.','ultimate-member') );
if ( ( UM()->options()->get( 'deny_admin_frontend_login' ) && ! isset( $_GET['provider'] ) ) && strrpos( um_user('wp_roles' ), 'administrator' ) !== false ) {
wp_die( __( 'This action has been prevented for security measures.', 'ultimate-member' ) );
}
UM()->user()->auto_login( um_user( 'ID' ), $rememberme );
+22 -21
View File
@@ -75,11 +75,11 @@ add_action( 'um_after_form_fields', 'um_browser_url_redirect_to' );
function um_add_update_notice( $args ) {
extract( $args );
$output = '';
$err = '';
$success = '';
$output = '';
$err = '';
$success = '';
if ( isset( $_REQUEST['updated'] ) && !empty( $_REQUEST['updated'] ) && ! UM()->form()->errors ) {
if ( ! empty( $_REQUEST['updated'] ) && ! UM()->form()->errors ) {
switch ( $_REQUEST['updated'] ) {
default:
/**
@@ -104,25 +104,25 @@ function um_add_update_notice( $args ) {
* }
* ?>
*/
$success = apply_filters( "um_custom_success_message_handler", $success, $_REQUEST['updated'] );
$success = apply_filters( 'um_custom_success_message_handler', $success, $_REQUEST['updated'] );
break;
case 'account':
$success = __('Your account was updated successfully.','ultimate-member');
$success = __( 'Your account was updated successfully.', 'ultimate-member' );
break;
case 'password_changed':
$success = __('You have successfully changed your password.','ultimate-member');
$success = __( 'You have successfully changed your password.', 'ultimate-member' );
break;
case 'account_active':
$success = __('Your account is now active! You can login.','ultimate-member');
$success = __( 'Your account is now active! You can login.', 'ultimate-member' );
break;
}
}
if ( isset( $_REQUEST['err'] ) && !empty( $_REQUEST['err'] ) && ! UM()->form()->errors ) {
if ( ! empty( $_REQUEST['err'] ) && ! UM()->form()->errors ) {
switch( $_REQUEST['err'] ) {
default:
@@ -148,51 +148,52 @@ function um_add_update_notice( $args ) {
* }
* ?>
*/
$err = apply_filters( "um_custom_error_message_handler", $err, $_REQUEST['err'] );
if ( !$err )
$err = apply_filters( 'um_custom_error_message_handler', $err, $_REQUEST['err'] );
if ( ! $err ) {
$err = __( 'An error has been encountered', 'ultimate-member' );
}
break;
case 'registration_disabled':
$err = __('Registration is currently disabled','ultimate-member');
$err = __( 'Registration is currently disabled', 'ultimate-member' );
break;
case 'blocked_email':
$err = __('This email address has been blocked.','ultimate-member');
$err = __( 'This email address has been blocked.', 'ultimate-member' );
break;
case 'blocked_domain':
$err = __('We do not accept registrations from that domain.','ultimate-member');
$err = __( 'We do not accept registrations from that domain.', 'ultimate-member' );
break;
case 'blocked_ip':
$err = __('Your IP address has been blocked.','ultimate-member');
$err = __( 'Your IP address has been blocked.', 'ultimate-member' );
break;
case 'inactive':
$err = __('Your account has been disabled.','ultimate-member');
$err = __( 'Your account has been disabled.', 'ultimate-member' );
break;
case 'awaiting_admin_review':
$err = __('Your account has not been approved yet.','ultimate-member');
$err = __( 'Your account has not been approved yet.', 'ultimate-member' );
break;
case 'awaiting_email_confirmation':
$err = __('Your account is awaiting e-mail verification.','ultimate-member');
$err = __( 'Your account is awaiting e-mail verification.', 'ultimate-member' );
break;
case 'rejected':
$err = __('Your membership request has been rejected.','ultimate-member');
$err = __( 'Your membership request has been rejected.', 'ultimate-member' );
break;
}
}
if ( isset( $err ) && !empty( $err ) ) {
if ( ! empty( $err ) ) {
$output .= '<p class="um-notice err"><i class="um-icon-ios-close-empty" onclick="jQuery(this).parent().fadeOut();"></i>' . $err . '</p>';
}
if ( isset( $success ) && !empty( $success ) ) {
if ( ! empty( $success ) ) {
$output .= '<p class="um-notice success"><i class="um-icon-ios-close-empty" onclick="jQuery(this).parent().fadeOut();"></i>' . $success . '</p>';
}
+4 -4
View File
@@ -34,19 +34,19 @@ add_filter( 'um_whitelisted_wpadmin_access', 'um_whitelisted_wpadmin_access' );
*/
function um_custom_wp_err_messages( $message ) {
if ( isset( $_REQUEST['err'] ) && !empty( $_REQUEST['err'] ) ) {
if ( ! empty( $_REQUEST['err'] ) ) {
switch( $_REQUEST['err'] ) {
case 'blocked_email':
$err = __('This email address has been blocked.','ultimate-member');
$err = __( 'This email address has been blocked.', 'ultimate-member' );
break;
case 'blocked_ip':
$err = __('Your IP address has been blocked.','ultimate-member');
$err = __( 'Your IP address has been blocked.', 'ultimate-member' );
break;
}
}
if ( isset( $err ) ) {
$message = '<div class="login" id="login_error">'.$err.'</div>';
$message = '<div class="login" id="login_error">' . $err . '</div>';
}
return $message;
+2 -1
View File
@@ -1427,8 +1427,9 @@ function um_get_metadefault( $id ) {
* @return bool
*/
function um_submitting_account_page() {
if (isset( $_POST['_um_account'] ) && $_POST['_um_account'] == 1 && is_user_logged_in())
if ( isset( $_POST['_um_account'] ) && $_POST['_um_account'] == 1 && is_user_logged_in() ) {
return true;
}
return false;
}