mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-20 07:04:06 +09:00
- 2.0.49 release;
This commit is contained in:
@@ -1225,8 +1225,16 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
*/
|
||||
function all_user_fields( $exclude_types = null, $show_all = false ) {
|
||||
|
||||
$fields_without_metakey = array('block','shortcode','spacing','divider','group');
|
||||
remove_filter('um_fields_without_metakey', 'um_user_tags_requires_no_metakey');
|
||||
$fields_without_metakey = array(
|
||||
'block',
|
||||
'shortcode',
|
||||
'spacing',
|
||||
'divider',
|
||||
'group'
|
||||
);
|
||||
$fields_without_metakey = apply_filters( 'um_fields_without_metakey', $fields_without_metakey );
|
||||
|
||||
remove_filter( 'um_fields_without_metakey', 'um_user_tags_requires_no_metakey' );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
|
||||
@@ -2084,19 +2084,19 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
|
||||
$output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="' . $key . '">';
|
||||
|
||||
if (isset( $data['label'] )) {
|
||||
if ( isset( $data['label'] ) ) {
|
||||
$output .= $this->field_label( $label, $key, $data );
|
||||
}
|
||||
|
||||
$output .= '<div class="um-field-area">';
|
||||
|
||||
if (isset( $icon ) && $icon && isset( $this->field_icons ) && $this->field_icons == 'field') {
|
||||
if ( isset( $icon ) && $icon && isset( $this->field_icons ) && $this->field_icons == 'field') {
|
||||
|
||||
$output .= '<div class="um-field-icon"><i class="' . $icon . '"></i></div>';
|
||||
|
||||
}
|
||||
|
||||
$output .= '<input ' . $disabled . ' class="' . $this->get_class( $key, $data ) . '" type="' . $input . '" name="' . $key . UM()->form()->form_suffix . '" id="' . $key . UM()->form()->form_suffix . '" value="' . $this->field_value( $key, $default, $data ) . '" placeholder="' . $placeholder . '" data-validate="' . $validate . '" data-key="' . $key . '" />
|
||||
$output .= '<input ' . $disabled . ' class="' . $this->get_class( $key, $data ) . '" type="' . $input . '" name="' . $key . UM()->form()->form_suffix . '" id="' . $key . UM()->form()->form_suffix . '" value="' . esc_attr( $this->field_value( $key, $default, $data ) ) . '" placeholder="' . esc_attr( $placeholder ) . '" data-validate="' . $validate . '" data-key="' . $key . '" />
|
||||
|
||||
</div>';
|
||||
|
||||
|
||||
@@ -337,7 +337,7 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
foreach ( $array as $key ) {
|
||||
if ( $key ) {
|
||||
$data = array();
|
||||
if ( isset( UM()->builtin()->all_user_fields[ $key ] ) ){
|
||||
if ( isset( UM()->builtin()->all_user_fields[ $key ] ) ) {
|
||||
$data = UM()->builtin()->all_user_fields[ $key ];
|
||||
}
|
||||
|
||||
|
||||
@@ -82,8 +82,10 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
add_action( 'user_register', array( &$this, 'set_gravatar' ), 11, 1 );
|
||||
|
||||
|
||||
add_action( 'added_existing_user', array( &$this, 'add_um_role_existing_user' ), 10, 2 );
|
||||
add_action( 'wpmu_activate_user', array( &$this, 'add_um_role_wpmu_new_user' ), 10, 1 );
|
||||
if ( is_multisite() ) {
|
||||
add_action( 'added_existing_user', array( &$this, 'add_um_role_existing_user' ), 10, 2 );
|
||||
add_action( 'wpmu_activate_user', array( &$this, 'add_um_role_wpmu_new_user' ), 10, 1 );
|
||||
}
|
||||
|
||||
add_action( 'init', array( &$this, 'check_membership' ), 10 );
|
||||
|
||||
@@ -187,8 +189,9 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*/
|
||||
function add_um_role_existing_user( $user_id, $result ) {
|
||||
// Bail if no user ID was passed
|
||||
if ( empty( $user_id ) )
|
||||
if ( empty( $user_id ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! empty( $_POST['um-role'] ) ) {
|
||||
if ( ! user_can( $user_id, $_POST['um-role'] ) ) {
|
||||
@@ -427,8 +430,9 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*/
|
||||
function user_register_via_admin( $user_id ) {
|
||||
|
||||
if ( empty( $user_id ) )
|
||||
if ( empty( $user_id ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_admin() ) {
|
||||
//if there custom 2 role not empty
|
||||
@@ -481,10 +485,12 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
$userdata = get_userdata( $user_id );
|
||||
$new_roles = $userdata->roles;
|
||||
|
||||
if ( ! empty( $_POST['um-role'] ) ) {
|
||||
$new_roles = array_merge( $new_roles, array( $_POST['um-role'] ) );
|
||||
if ( ! user_can( $user_id, $_POST['um-role'] ) ) {
|
||||
UM()->roles()->set_role( $user_id, $_POST['um-role'] );
|
||||
if ( is_admin() ) {
|
||||
if ( ! empty( $_POST['um-role'] ) ) {
|
||||
$new_roles = array_merge( $new_roles, array( $_POST['um-role'] ) );
|
||||
if ( ! user_can( $user_id, $_POST['um-role'] ) ) {
|
||||
UM()->roles()->set_role( $user_id, $_POST['um-role'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ function um_submit_account_details( $args ) {
|
||||
|
||||
UM()->user()->password_changed();
|
||||
|
||||
do_action( 'send_password_change_email', $args );
|
||||
add_filter( 'send_password_change_email', '__return_false' );
|
||||
|
||||
//clear all sessions with old passwords
|
||||
$user = WP_Session_Tokens::get_instance( um_user( 'ID' ) );
|
||||
|
||||
@@ -119,7 +119,7 @@ function um_profile_content_main( $args ) {
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( "um_after_form_fields", $args );
|
||||
do_action( 'um_after_form_fields', $args );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
@@ -921,7 +921,7 @@ function um_profile_header( $args ) {
|
||||
|
||||
</div>
|
||||
|
||||
<?php if (isset( $args['metafields'] ) && !empty( $args['metafields'] )) { ?>
|
||||
<?php if ( ! empty( $args['metafields'] ) ) { ?>
|
||||
<div class="um-meta">
|
||||
|
||||
<?php echo UM()->profile()->show_meta( $args['metafields'] ); ?>
|
||||
|
||||
@@ -378,6 +378,27 @@ function um_prepare_user_query_args( $query_args, $args ) {
|
||||
|
||||
} elseif ( 'display_name' == $sortby ) {
|
||||
|
||||
/*$display_name = UM()->options()->get( 'display_name' );
|
||||
if ( $display_name == 'username' ) {
|
||||
$query_args['orderby'] = 'user_login';
|
||||
$order = 'ASC';
|
||||
} else {
|
||||
$query_args['meta_query'][] = array(
|
||||
'relation' => 'OR',
|
||||
'full_name' => array(
|
||||
'key' => 'full_name',
|
||||
'compare' => 'EXISTS'
|
||||
),
|
||||
array(
|
||||
'key' => 'full_name',
|
||||
'compare' => 'NOT EXISTS'
|
||||
)
|
||||
);
|
||||
|
||||
$query_args['orderby'] = 'full_name, display_name';
|
||||
$order = 'ASC';
|
||||
}*/
|
||||
|
||||
$query_args['meta_query'][] = array(
|
||||
'relation' => 'OR',
|
||||
'full_name' => array(
|
||||
|
||||
Reference in New Issue
Block a user