- fixed members search in some cases (serialized int values);

- fixed admin notices;
This commit is contained in:
nikitozzzzzzz
2018-07-06 16:40:16 +03:00
parent 9820e1e6b3
commit 7099a57e21
4 changed files with 23 additions and 4 deletions
+3 -2
View File
@@ -30,6 +30,7 @@ jQuery(document).ready(function() {
jQuery(document).on('click', '#um_opt_in_start', function (e) {
var obj = jQuery(this);
var dismiss = jQuery(this).parents('.um-admin-notice').find( '.notice-dismiss' );
jQuery(this).prop('disabled', true).attr('disabled', 'disabled');
@@ -39,10 +40,10 @@ jQuery(document).ready(function() {
},
success: function( data ) {
dismiss.trigger('click');
jQuery(this).prop('disabled', false);
obj.prop('disabled', false).removeAttr( 'disabled' );
},
error: function( data ) {
jQuery(this).prop('disabled', false);
obj.prop('disabled', false).removeAttr( 'disabled' );
return false;
}
});
+4 -2
View File
@@ -359,11 +359,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
* ?>
*/
$localize_data = apply_filters('um_admin_enqueue_localize_data', array(
'ajaxurl' => admin_url( 'admin-ajax.php' )
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( "um-admin-nonce" )
)
);
wp_localize_script( 'um_admin_scripts', 'um_admin_scripts', $localize_data );
wp_localize_script( 'um_admin_global', 'um_admin_scripts', $localize_data );
}
@@ -427,6 +428,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
} else {
$this->load_global_scripts();
$this->load_localize_scripts();
}
@@ -698,6 +698,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
function dismiss_notice() {
$nonce = isset( $_POST["nonce"] ) ? $_POST["nonce"] : "";
if ( ! wp_verify_nonce( $nonce, "um-admin-nonce" ) ) {
wp_send_json_error( esc_js( __( "Wrong Nonce", 'ultimate-member' ) ) );
}
if ( empty( $_POST['key'] ) ) {
wp_send_json_error( __( 'Wrong Data', 'ultimate-member' ) );
}
@@ -712,6 +718,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
function opt_in_notice() {
$nonce = isset( $_POST["nonce"] ) ? $_POST["nonce"] : "";
if ( ! wp_verify_nonce( $nonce, "um-admin-nonce" ) ) {
wp_send_json_error( esc_js( __( "Wrong Nonce", 'ultimate-member' ) ) );
}
// Send a maximum of once per period
$last_send = get_option( 'um_opt_in_last_send', false );
if ( $last_send && $last_send > strtotime( '-1 day' ) ) {
+5
View File
@@ -160,6 +160,11 @@ function um_add_search_to_query( $query_args, $args ){
'value' => serialize( strval( trim( $value ) ) ),
'compare' => 'LIKE',
),
array(
'key' => $field,
'value' => serialize( intval( trim( $value ) ) ),
'compare' => 'LIKE',
)
) );
}
} else {