mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Merge pull request #977 from ultimatemember/development/2.3.1
Development/2.3.1
This commit is contained in:
@@ -1,10 +1,24 @@
|
||||
jQuery( document ).ready( function() {
|
||||
|
||||
|
||||
/**
|
||||
* Licenses
|
||||
*/
|
||||
jQuery( document.body ).on( 'click', '.um_license_deactivate', function() {
|
||||
jQuery(this).siblings('.um-option-field').val('');
|
||||
jQuery(this).parents('form.um-settings-form').trigger('submit');
|
||||
if ( jQuery(this).siblings('#submit').length ) {
|
||||
// clear = true for passing the empty field value to the license form submission
|
||||
jQuery(this).siblings('#submit').trigger('click',[ true ]);
|
||||
} else {
|
||||
jQuery(this).parents('form.um-settings-form').trigger('submit');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
jQuery( document.body ).on( 'click', '.um-settings-form #submit', function( e, clear ) {
|
||||
if ( ! clear && '' === jQuery(this).siblings('.um-option-field').val() ) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -32,4 +46,4 @@ jQuery( document ).ready( function() {
|
||||
window.onbeforeunload = '';
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -106,8 +106,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
|
||||
$this->um_cpt_form_screen = true;
|
||||
add_action( 'admin_footer', array( $this, 'admin_footer_scripts' ), 20 );
|
||||
}
|
||||
|
||||
$this->post_page = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -646,14 +644,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
|
||||
}
|
||||
|
||||
global $wp_version, $current_screen;
|
||||
if ( version_compare( $wp_version, '5.0', '>=' ) && ! empty( $this->post_page ) ) {
|
||||
|
||||
if ( version_compare( $wp_version, '5.0', '>=' ) ) {
|
||||
if ( $current_screen->is_block_editor() ) {
|
||||
$this->load_gutenberg_js();
|
||||
$this->load_gutenberg_shortcode_blocks();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2364,7 +2364,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
||||
|
||||
<div class="um-admin-tri">
|
||||
|
||||
<p><label for="_editable"><?php _e( 'Can user edit this field?', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This option allows you to set whether or not the user can edit the information in this field.', 'ultimate-member' ) ); ?></label>
|
||||
<p><label for="_editable"><?php _e( 'Can user edit this field?', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This option allows you to set whether or not the user can edit the information in this field. The site admin can edit all fields regardless of the option set here.', 'ultimate-member' ) ); ?></label>
|
||||
<input type="hidden" name="_editable" id="_editable_hidden" value="0" />
|
||||
<input type="checkbox" name="_editable" id="_editable" value="1" <?php checked( null === $this->edit_mode_value || $this->edit_mode_value ) ?> />
|
||||
</p>
|
||||
|
||||
@@ -426,6 +426,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
$messages[0]['content'] = __( 'The form has been duplicated successfully.', 'ultimate-member' );
|
||||
break;
|
||||
|
||||
case 'settings_updated':
|
||||
$messages[0]['content'] = __( 'Settings have been saved successfully.', 'ultimate-member' );
|
||||
break;
|
||||
|
||||
case 'user_updated':
|
||||
$messages[0]['content'] = __( 'User has been updated.', 'ultimate-member' );
|
||||
break;
|
||||
@@ -532,7 +536,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="<?php echo esc_url( $url ) ?>" class="button button-primary"><?php _e( 'Upgrade Now', 'ultimate-member' ) ?></a>
|
||||
<a href="<?php echo esc_url( $url ) ?>" class="button button-primary"><?php _e( 'Visit Upgrade Page', 'ultimate-member' ) ?></a>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
@@ -1280,13 +1280,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
array(
|
||||
'id' => 'blocked_emails',
|
||||
'type' => 'textarea',
|
||||
'label' => __( 'Blocked Email Addresses', 'ultimate-member' ),
|
||||
'label' => __( 'Blocked Email Addresses (Enter one email per line)', 'ultimate-member' ),
|
||||
'tooltip' => __( 'This will block the specified e-mail addresses from being able to sign up or sign in to your site. To block an entire domain, use something like *@domain.com', 'ultimate-member' ),
|
||||
),
|
||||
array(
|
||||
'id' => 'blocked_words',
|
||||
'type' => 'textarea',
|
||||
'label' => __( 'Blacklist Words', 'ultimate-member' ),
|
||||
'label' => __( 'Blacklist Words (Enter one word per line)', 'ultimate-member' ),
|
||||
'tooltip' => __( 'This option lets you specify blacklist of words to prevent anyone from signing up with such a word as their username', 'ultimate-member' ),
|
||||
),
|
||||
),
|
||||
@@ -1810,39 +1810,32 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
*/
|
||||
public function sorting_licenses_options( $settings ) {
|
||||
//sorting licenses
|
||||
if ( empty( $settings['licenses']['fields'] ) ) {
|
||||
return $settings;
|
||||
if ( ! empty( $settings['licenses']['fields'] ) ) {
|
||||
$licenses = $settings['licenses']['fields'];
|
||||
@uasort( $licenses, function( $a, $b ) {
|
||||
return strnatcasecmp( $a['label'], $b['label'] );
|
||||
} );
|
||||
$settings['licenses']['fields'] = $licenses;
|
||||
}
|
||||
|
||||
$licenses = $settings['licenses']['fields'];
|
||||
@uasort( $licenses, function( $a, $b ) {
|
||||
return strnatcasecmp( $a['label'], $b['label'] );
|
||||
} );
|
||||
$settings['licenses']['fields'] = $licenses;
|
||||
//sorting extensions by the title
|
||||
if ( ! empty( $settings['extensions']['sections'] ) ) {
|
||||
$extensions = $settings['extensions']['sections'];
|
||||
|
||||
//sorting extensions
|
||||
if ( empty( $settings['extensions']['sections'] ) ) {
|
||||
return $settings;
|
||||
}
|
||||
|
||||
$extensions = $settings['extensions']['sections'];
|
||||
@uasort( $extensions, function( $a, $b ) {
|
||||
return strnatcasecmp( $a['title'], $b['title'] );
|
||||
} );
|
||||
|
||||
$keys = array_keys( $extensions );
|
||||
if ( $keys[0] !== '' ) {
|
||||
$new_key = strtolower( str_replace( ' ', '_', $extensions['']['title'] ) );
|
||||
$temp = $extensions[''];
|
||||
$extensions[ $new_key ] = $temp;
|
||||
$extensions[''] = $extensions[ $keys[0] ];
|
||||
unset( $extensions[ $keys[0] ] );
|
||||
@uasort( $extensions, function( $a, $b ) {
|
||||
return strnatcasecmp( $a['title'], $b['title'] );
|
||||
} );
|
||||
}
|
||||
|
||||
$settings['extensions']['sections'] = $extensions;
|
||||
$keys = array_keys( $extensions );
|
||||
$temp = array(
|
||||
'' => $extensions[ $keys[0] ],
|
||||
);
|
||||
|
||||
unset( $extensions[ $keys[0] ] );
|
||||
$extensions = $temp + $extensions;
|
||||
|
||||
$settings['extensions']['sections'] = $extensions;
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
@@ -2227,7 +2220,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
|
||||
//redirect after save settings
|
||||
$arg = array(
|
||||
'page' => 'um_options',
|
||||
'page' => 'um_options',
|
||||
'update' => 'settings_updated',
|
||||
);
|
||||
|
||||
if ( ! empty( $_GET['tab'] ) ) {
|
||||
@@ -2949,6 +2943,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Activate', 'ultimate-member' ) ?>" />
|
||||
<?php } else { ?>
|
||||
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Re-Activate', 'ultimate-member' ) ?>" />
|
||||
<input type="button" class="button um_license_deactivate" id="<?php echo esc_attr( $field_data['id'] ) ?>_deactivate" value="<?php esc_attr_e( 'Clear License', 'ultimate-member' ) ?>"/>
|
||||
<?php }
|
||||
|
||||
if ( ! empty( $messages ) ) {
|
||||
|
||||
@@ -213,6 +213,8 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
//run activation
|
||||
register_activation_hook( um_plugin, array( &$this, 'activation' ) );
|
||||
|
||||
register_deactivation_hook( um_plugin, array( &$this, 'deactivation' ) );
|
||||
|
||||
if ( is_multisite() && ! defined( 'DOING_AJAX' ) ) {
|
||||
add_action( 'wp_loaded', array( $this, 'maybe_network_activation' ) );
|
||||
}
|
||||
@@ -454,6 +456,16 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Plugin Deactivation
|
||||
*
|
||||
* @since 2.3
|
||||
*/
|
||||
function deactivation() {
|
||||
$this->cron()->unschedule_events();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Maybe need multisite activation process
|
||||
*
|
||||
|
||||
@@ -116,5 +116,12 @@ if ( ! class_exists( 'um\core\Cron' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function unschedule_events() {
|
||||
wp_clear_scheduled_hook( 'um_weekly_scheduled_events' );
|
||||
wp_clear_scheduled_hook( 'um_daily_scheduled_events' );
|
||||
wp_clear_scheduled_hook( 'um_twicedaily_scheduled_events' );
|
||||
wp_clear_scheduled_hook( 'um_hourly_scheduled_events' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2730,39 +2730,54 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
} else {
|
||||
$img = '';
|
||||
}
|
||||
$output .= '<div class="um-single-image-preview show ' . $crop_class . '" data-crop="' . $crop_data . '" data-key="' . $key . '">
|
||||
<a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a>' . $img . '
|
||||
</div><a href="javascript:void(0);" data-modal="um_upload_single" data-modal-size="' . $modal_size . '" data-modal-copy="1" class="um-button um-btn-auto-width">' . __( 'Change photo', 'ultimate-member' ) . '</a>';
|
||||
$output .= '<div class="um-single-image-preview show ' . $crop_class . '" data-crop="' . $crop_data . '" data-key="' . $key . '">';
|
||||
if ( empty( $disabled ) ) {
|
||||
$output .= '<a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a>';
|
||||
}
|
||||
$output .= $img;
|
||||
$output .= '</div>';
|
||||
if ( empty( $disabled ) ) {
|
||||
$output .= '<a href="javascript:void(0);" data-modal="um_upload_single" data-modal-size="' . $modal_size . '" data-modal-copy="1" class="um-button um-btn-auto-width">' . __( 'Change photo', 'ultimate-member' ) . '</a>';
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$output .= '<div class="um-single-image-preview ' . $crop_class . '" data-crop="' . $crop_data . '" data-key="' . $key . '">
|
||||
<a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a>
|
||||
<img src="" alt="" />
|
||||
<div class="um-clear"></div></div><a href="javascript:void(0);" data-modal="um_upload_single" data-modal-size="' . $modal_size . '" data-modal-copy="1" class="um-button um-btn-auto-width">' . $button_text . '</a>';
|
||||
$output .= '<div class="um-single-image-preview ' . $crop_class . '" data-crop="' . $crop_data . '" data-key="' . $key . '">';
|
||||
if ( empty( $disabled ) ) {
|
||||
$output .= '<a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a>';
|
||||
}
|
||||
$output .= '<img src="" alt="" /><div class="um-clear"></div></div>';
|
||||
if ( empty( $disabled ) ) {
|
||||
$output .= '<a href="javascript:void(0);" data-modal="um_upload_single" data-modal-size="' . $modal_size . '" data-modal-copy="1" class="um-button um-btn-auto-width">' . $button_text . '</a>';
|
||||
}
|
||||
|
||||
}
|
||||
$output .= '</div>';
|
||||
/* modal hidden */
|
||||
$output .= '<div class="um-modal-hidden-content">';
|
||||
$output .= '<div class="um-modal-header"> ' . $modal_label . '</div>';
|
||||
$output .= '<div class="um-modal-body">';
|
||||
if (isset( $this->set_id )) {
|
||||
$set_id = $this->set_id;
|
||||
$set_mode = $this->set_mode;
|
||||
} else {
|
||||
$set_id = 0;
|
||||
$set_mode = '';
|
||||
}
|
||||
$nonce = wp_create_nonce( 'um_upload_nonce-' . $this->timestamp );
|
||||
$output .= '<div class="um-single-image-preview ' . $crop_class . '" data-crop="' . $crop_data . '" data-ratio="' . $ratio . '" data-min_width="' . $min_width . '" data-min_height="' . $min_height . '" data-coord=""><a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a><img src="" alt="" /><div class="um-clear"></div></div><div class="um-clear"></div>';
|
||||
$output .= '<div class="um-single-image-upload" data-user_id="' . esc_attr( $_um_profile_id ) . '" data-nonce="' . $nonce . '" data-timestamp="' . esc_attr( $this->timestamp ) . '" data-icon="' . esc_attr( $icon ) . '" data-set_id="' . esc_attr( $set_id ) . '" data-set_mode="' . esc_attr( $set_mode ) . '" data-type="' . esc_attr( $type ) . '" data-key="' . esc_attr( $key ) . '" data-max_size="' . esc_attr( $max_size ) . '" data-max_size_error="' . esc_attr( $max_size_error ) . '" data-min_size_error="' . esc_attr( $min_size_error ) . '" data-extension_error="' . esc_attr( $extension_error ) . '" data-allowed_types="' . esc_attr( $allowed_types ) . '" data-upload_text="' . esc_attr( $upload_text ) . '" data-max_files_error="' . esc_attr( $max_files_error ) . '" data-upload_help_text="' . esc_attr( $upload_help_text ) . '">' . $button_text . '</div>';
|
||||
$output .= '<div class="um-modal-footer">
|
||||
if ( empty( $disabled ) ) {
|
||||
$output .= '<div class="um-modal-hidden-content">';
|
||||
$output .= '<div class="um-modal-header"> ' . $modal_label . '</div>';
|
||||
$output .= '<div class="um-modal-body">';
|
||||
if ( isset( $this->set_id ) ) {
|
||||
$set_id = $this->set_id;
|
||||
$set_mode = $this->set_mode;
|
||||
} else {
|
||||
$set_id = 0;
|
||||
$set_mode = '';
|
||||
}
|
||||
$nonce = wp_create_nonce( 'um_upload_nonce-' . $this->timestamp );
|
||||
$output .= '<div class="um-single-image-preview ' . $crop_class . '" data-crop="' . $crop_data . '" data-ratio="' . $ratio . '" data-min_width="' . $min_width . '" data-min_height="' . $min_height . '" data-coord=""><a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a><img src="" alt="" /><div class="um-clear"></div></div><div class="um-clear"></div>';
|
||||
$output .= '<div class="um-single-image-upload" data-user_id="' . esc_attr( $_um_profile_id ) . '" data-nonce="' . $nonce . '" data-timestamp="' . esc_attr( $this->timestamp ) . '" data-icon="' . esc_attr( $icon ) . '" data-set_id="' . esc_attr( $set_id ) . '" data-set_mode="' . esc_attr( $set_mode ) . '" data-type="' . esc_attr( $type ) . '" data-key="' . esc_attr( $key ) . '" data-max_size="' . esc_attr( $max_size ) . '" data-max_size_error="' . esc_attr( $max_size_error ) . '" data-min_size_error="' . esc_attr( $min_size_error ) . '" data-extension_error="' . esc_attr( $extension_error ) . '" data-allowed_types="' . esc_attr( $allowed_types ) . '" data-upload_text="' . esc_attr( $upload_text ) . '" data-max_files_error="' . esc_attr( $max_files_error ) . '" data-upload_help_text="' . esc_attr( $upload_help_text ) . '">' . $button_text . '</div>';
|
||||
$output .= '<div class="um-modal-footer">
|
||||
<div class="um-modal-right">
|
||||
<a href="javascript:void(0);" class="um-modal-btn um-finish-upload image disabled" data-key="' . $key . '" data-change="' . __( 'Change photo', 'ultimate-member' ) . '" data-processing="' . __( 'Processing...', 'ultimate-member' ) . '"> ' . __( 'Apply', 'ultimate-member' ) . '</a>
|
||||
<a href="javascript:void(0);" class="um-modal-btn alt" data-action="um_remove_modal"> ' . __( 'Cancel', 'ultimate-member' ) . '</a>
|
||||
</div>
|
||||
<div class="um-clear"></div>
|
||||
</div>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
}
|
||||
/* end */
|
||||
if ( $this->is_error( $key ) ) {
|
||||
$output .= $this->field_error( $this->show_error( $key ) );
|
||||
@@ -2813,9 +2828,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
}
|
||||
|
||||
if ( file_exists( $file_dir ) ) {
|
||||
$output .= "<div class=\"um-single-file-preview show\" data-key=\"{$key}\">
|
||||
<a href=\"#\" class=\"cancel\"><i class=\"um-icon-close\"></i></a>
|
||||
<div class=\"um-single-fileinfo\">
|
||||
$output .= "<div class=\"um-single-file-preview show\" data-key=\"{$key}\">";
|
||||
if ( empty( $disabled ) ) {
|
||||
$output .= "<a href=\"#\" class=\"cancel\"><i class=\"um-icon-close\"></i></a>";
|
||||
}
|
||||
$output .= "<div class=\"um-single-fileinfo\">
|
||||
<a href=\"{$file_url}\" target=\"_blank\">
|
||||
<span class=\"icon\" style=\"background:" . UM()->files()->get_fonticon_bg_by_ext( $file_type['ext'] ) . "\"><i class=\"" . UM()->files()->get_fonticon_by_ext( $file_type['ext'] ) . "\"></i></span>
|
||||
<span class=\"filename\">{$file_field_name}</span>
|
||||
@@ -2825,24 +2842,29 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$output .= "<div class=\"um-single-file-preview show\" data-key=\"{$key}\">" . __('This file has been removed.','ultimate-member') . "</div>";
|
||||
}
|
||||
|
||||
$output .= "<a href=\"#\" data-modal=\"um_upload_single\" data-modal-size=\"{$modal_size}\" data-modal-copy=\"1\" class=\"um-button um-btn-auto-width\">" . __( 'Change file', 'ultimate-member' ) . "</a>";
|
||||
if ( empty( $disabled ) ) {
|
||||
$output .= "<a href=\"#\" data-modal=\"um_upload_single\" data-modal-size=\"{$modal_size}\" data-modal-copy=\"1\" class=\"um-button um-btn-auto-width\">" . __( 'Change file', 'ultimate-member' ) . "</a>";
|
||||
}
|
||||
} else {
|
||||
$output .= "<div class=\"um-single-file-preview\" data-key=\"{$key}\">
|
||||
</div><a href=\"#\" data-modal=\"um_upload_single\" data-modal-size=\"{$modal_size}\" data-modal-copy=\"1\" class=\"um-button um-btn-auto-width\">{$button_text}</a>";
|
||||
$output .= "<div class=\"um-single-file-preview\" data-key=\"{$key}\"></div>";
|
||||
if ( empty( $disabled ) ) {
|
||||
$output .= "<a href=\"#\" data-modal=\"um_upload_single\" data-modal-size=\"{$modal_size}\" data-modal-copy=\"1\" class=\"um-button um-btn-auto-width\">{$button_text}</a>";
|
||||
}
|
||||
}
|
||||
$output .= '</div>';
|
||||
/* modal hidden */
|
||||
$output .= '<div class="um-modal-hidden-content">';
|
||||
$output .= '<div class="um-modal-header"> ' . $modal_label . '</div>';
|
||||
$output .= '<div class="um-modal-body">';
|
||||
if ( isset( $this->set_id ) ) {
|
||||
$set_id = $this->set_id;
|
||||
$set_mode = $this->set_mode;
|
||||
} else {
|
||||
$set_id = 0;
|
||||
$set_mode = '';
|
||||
}
|
||||
$output .= '<div class="um-single-file-preview">
|
||||
if ( empty( $disabled ) ) {
|
||||
$output .= '<div class="um-modal-hidden-content">';
|
||||
$output .= '<div class="um-modal-header"> ' . $modal_label . '</div>';
|
||||
$output .= '<div class="um-modal-body">';
|
||||
if ( isset( $this->set_id ) ) {
|
||||
$set_id = $this->set_id;
|
||||
$set_mode = $this->set_mode;
|
||||
} else {
|
||||
$set_id = 0;
|
||||
$set_mode = '';
|
||||
}
|
||||
$output .= '<div class="um-single-file-preview">
|
||||
<a href="javascript:void(0);" class="cancel"><i class="um-icon-close"></i></a>
|
||||
<div class="um-single-fileinfo">
|
||||
<a href="" target="_blank">
|
||||
@@ -2851,17 +2873,18 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
</a>
|
||||
</div>
|
||||
</div>';
|
||||
$nonce = wp_create_nonce( 'um_upload_nonce-' . $this->timestamp );
|
||||
$output .= '<div class="um-single-file-upload" data-user_id="' . esc_attr( $_um_profile_id ) . '" data-timestamp="' . esc_attr( $this->timestamp ) . '" data-nonce="' . $nonce . '" data-icon="' . esc_attr( $icon ) . '" data-set_id="' . esc_attr( $set_id ) . '" data-set_mode="' . esc_attr( $set_mode ) . '" data-type="' . esc_attr( $type ) . '" data-key="' . esc_attr( $key ) . '" data-max_size="' . esc_attr( $max_size ) . '" data-max_size_error="' . esc_attr( $max_size_error ) . '" data-min_size_error="' . esc_attr( $min_size_error ) . '" data-extension_error="' . esc_attr( $extension_error ) . '" data-allowed_types="' . esc_attr( $allowed_types ) . '" data-upload_text="' . esc_attr( $upload_text ) . '" data-max_files_error="' . esc_attr( $max_files_error ) . '" data-upload_help_text="' . esc_attr( $upload_help_text ) . '">' . $button_text . '</div>';
|
||||
$output .= '<div class="um-modal-footer">
|
||||
$nonce = wp_create_nonce( 'um_upload_nonce-' . $this->timestamp );
|
||||
$output .= '<div class="um-single-file-upload" data-user_id="' . esc_attr( $_um_profile_id ) . '" data-timestamp="' . esc_attr( $this->timestamp ) . '" data-nonce="' . $nonce . '" data-icon="' . esc_attr( $icon ) . '" data-set_id="' . esc_attr( $set_id ) . '" data-set_mode="' . esc_attr( $set_mode ) . '" data-type="' . esc_attr( $type ) . '" data-key="' . esc_attr( $key ) . '" data-max_size="' . esc_attr( $max_size ) . '" data-max_size_error="' . esc_attr( $max_size_error ) . '" data-min_size_error="' . esc_attr( $min_size_error ) . '" data-extension_error="' . esc_attr( $extension_error ) . '" data-allowed_types="' . esc_attr( $allowed_types ) . '" data-upload_text="' . esc_attr( $upload_text ) . '" data-max_files_error="' . esc_attr( $max_files_error ) . '" data-upload_help_text="' . esc_attr( $upload_help_text ) . '">' . $button_text . '</div>';
|
||||
$output .= '<div class="um-modal-footer">
|
||||
<div class="um-modal-right">
|
||||
<a href="javascript:void(0);" class="um-modal-btn um-finish-upload file disabled" data-key="' . esc_attr( $key ) . '" data-change="' . esc_attr__( 'Change file' ) . '" data-processing="' . esc_attr__( 'Processing...', 'ultimate-member' ) . '"> ' . __( 'Save', 'ultimate-member' ) . '</a>
|
||||
<a href="javascript:void(0);" class="um-modal-btn alt" data-action="um_remove_modal"> ' . __( 'Cancel', 'ultimate-member' ) . '</a>
|
||||
</div>
|
||||
<div class="um-clear"></div>
|
||||
</div>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
}
|
||||
/* end */
|
||||
if ( $this->is_error( $key ) ) {
|
||||
$output .= $this->field_error( $this->show_error( $key ) );
|
||||
|
||||
@@ -2586,12 +2586,13 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
* @param string $element
|
||||
* @param string $trigger
|
||||
* @param array $items
|
||||
* @param string $parent
|
||||
*/
|
||||
function dropdown_menu( $element, $trigger, $items = array() ) {
|
||||
function dropdown_menu( $element, $trigger, $items = array(), $parent = '' ) {
|
||||
// !!!!Important: all links in the dropdown items must have "class" attribute
|
||||
?>
|
||||
|
||||
<div class="um-new-dropdown" data-element="<?php echo $element; ?>" data-trigger="<?php echo $trigger; ?>">
|
||||
<div class="um-new-dropdown" data-element="<?php echo $element; ?>" data-trigger="<?php echo $trigger; ?>" data-parent="<?php echo $parent; ?>">
|
||||
<ul>
|
||||
<?php foreach ( $items as $k => $v ) { ?>
|
||||
<li><?php echo $v; ?></li>
|
||||
@@ -2610,11 +2611,12 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
* @param string $trigger
|
||||
* @param string $item
|
||||
* @param string $additional_attributes
|
||||
* @param string $parent
|
||||
*/
|
||||
function dropdown_menu_js( $element, $trigger, $item, $additional_attributes = '' ) {
|
||||
function dropdown_menu_js( $element, $trigger, $item, $additional_attributes = '', $parent = '' ) {
|
||||
?>
|
||||
|
||||
<div class="um-new-dropdown" data-element="<?php echo $element; ?>" data-trigger="<?php echo $trigger; ?>">
|
||||
<div class="um-new-dropdown" data-element="<?php echo $element; ?>" data-trigger="<?php echo $trigger; ?>" data-parent="<?php echo $parent; ?>">
|
||||
<ul>
|
||||
<# _.each( <?php echo $item; ?>.dropdown_actions, function( action, key, list ) { #>
|
||||
<li><a href="<# if ( typeof action.url != 'undefined' ) { #>{{{action.url}}}<# } else { #>javascript:void(0);<# }#>" class="{{{key}}}"<?php echo $additional_attributes ? " $additional_attributes" : '' ?>>{{{action.title}}}</a></li>
|
||||
|
||||
@@ -19,15 +19,8 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
* Plugin_Updater constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
//create cron event
|
||||
if ( ! wp_next_scheduled( 'um_check_extensions_licenses' ) ) {
|
||||
wp_schedule_event( time() + ( 24*60*60 ), 'daily', 'um_check_extensions_licenses' );
|
||||
}
|
||||
|
||||
register_deactivation_hook( um_plugin, array( &$this, 'um_plugin_updater_deactivation_hook' ) );
|
||||
|
||||
//cron request to UM()->store_url;
|
||||
add_action( 'um_check_extensions_licenses', array( &$this, 'um_checklicenses' ) );
|
||||
add_action( 'um_daily_scheduled_events', array( &$this, 'um_checklicenses' ) );
|
||||
|
||||
// clean update plugin cache
|
||||
add_action( 'upgrader_process_complete', array( &$this, 'clean_update_plugins_cache' ), 20, 2 );
|
||||
@@ -248,14 +241,6 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove CRON events on deactivation hook
|
||||
*/
|
||||
function um_plugin_updater_deactivation_hook() {
|
||||
wp_clear_scheduled_hook( 'um_check_extensions_licenses' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check license function
|
||||
*/
|
||||
@@ -665,4 +650,4 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ if ( ! class_exists( 'um\core\Query' ) ) {
|
||||
* @return int
|
||||
*/
|
||||
function count_users_by_status( $status ) {
|
||||
$args = array( 'fields' => 'ID', 'number' => 0 );
|
||||
$args = array( 'fields' => 'ID', 'number' => 0, 'um_custom_user_query' => true );
|
||||
if ( $status == 'unassigned' ) {
|
||||
$args['meta_query'][] = array(array('key' => 'account_status','compare' => 'NOT EXISTS'));
|
||||
$users = new \WP_User_Query( $args );
|
||||
|
||||
@@ -1352,8 +1352,11 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
$_array = $new_files;
|
||||
if ( ! empty( UM()->builtin()->custom_fields ) ) {
|
||||
foreach ( UM()->builtin()->custom_fields as $_field ) {
|
||||
if ( in_array( $_field['type'], array( 'file', 'image' ) ) && isset( $user_meta_keys[$_field['metakey']] ) && empty( $_array[$_field['metakey']] ) ) {
|
||||
$_array[$_field['metakey']] = $user_meta_keys[$_field['metakey']];
|
||||
if ( ! array_key_exists( 'type', $_field ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( in_array( $_field['type'], array( 'file', 'image' ), true ) && isset( $user_meta_keys[ $_field['metakey'] ] ) && empty( $_array[ $_field['metakey'] ] ) ) {
|
||||
$_array[ $_field['metakey'] ] = $user_meta_keys[ $_field['metakey'] ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,36 +12,33 @@ function um_submit_form_errors_hook__blockedemails( $args ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$emails = strtolower( $emails );
|
||||
$emails = array_map( 'rtrim', explode( "\n", $emails ) );
|
||||
|
||||
if ( isset( $args['user_email'] ) && is_email( $args['user_email'] ) ) {
|
||||
|
||||
$domain = explode( '@', $args['user_email'] );
|
||||
$check_domain = str_replace( $domain[0], '*', $args['user_email'] );
|
||||
|
||||
if ( in_array( $args['user_email'], $emails ) ) {
|
||||
if ( in_array( strtolower( $args['user_email'] ), $emails ) ) {
|
||||
exit( wp_redirect( esc_url( add_query_arg( 'err', 'blocked_email' ) ) ) );
|
||||
}
|
||||
|
||||
if ( in_array( $check_domain, $emails ) ) {
|
||||
$domain = explode( '@', $args['user_email'] );
|
||||
$check_domain = str_replace( $domain[0], '*', $args['user_email'] );
|
||||
|
||||
if ( in_array( strtolower( $check_domain ), $emails ) ) {
|
||||
exit( wp_redirect( esc_url( add_query_arg( 'err', 'blocked_domain' ) ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( isset( $args['username'] ) && is_email( $args['username'] ) ) {
|
||||
|
||||
$domain = explode( '@', $args['username'] );
|
||||
$check_domain = str_replace( $domain[0], '*', $args['username'] );
|
||||
|
||||
if ( in_array( $args['username'], $emails ) ) {
|
||||
if ( in_array( strtolower( $args['username'] ), $emails ) ) {
|
||||
exit( wp_redirect( esc_url( add_query_arg( 'err', 'blocked_email' ) ) ) );
|
||||
}
|
||||
|
||||
if ( in_array( $check_domain, $emails ) ) {
|
||||
$domain = explode( '@', $args['username'] );
|
||||
$check_domain = str_replace( $domain[0], '*', $args['username'] );
|
||||
|
||||
if ( in_array( strtolower( $check_domain ), $emails ) ) {
|
||||
exit( wp_redirect( esc_url( add_query_arg( 'err', 'blocked_domain' ) ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
add_action( 'um_submit_form_errors_hook__blockedemails', 'um_submit_form_errors_hook__blockedemails', 10 );
|
||||
@@ -86,11 +83,12 @@ function um_submit_form_errors_hook__blockedwords( $args ) {
|
||||
$mode = $args['mode'];
|
||||
$fields = unserialize( $args['custom_fields'] );
|
||||
|
||||
$words = strtolower( $words );
|
||||
$words = array_map( 'rtrim', explode( "\n", $words ) );
|
||||
if ( ! empty( $fields ) && is_array( $fields ) ) {
|
||||
foreach ( $fields as $key => $array ) {
|
||||
if ( isset( $array['validate'] ) && in_array( $array['validate'], array( 'unique_username', 'unique_email', 'unique_username_or_email' ) ) ) {
|
||||
if ( ! UM()->form()->has_error( $key ) && isset( $args[ $key ] ) && in_array( $args[ $key ], $words ) ) {
|
||||
if ( ! UM()->form()->has_error( $key ) && isset( $args[ $key ] ) && in_array( strtolower( $args[ $key ] ), $words ) ) {
|
||||
UM()->form()->add_error( $key, __( 'You are not allowed to use this word as your username.', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user