mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- 2.0.24 upgrade;
- wp nativve ajax handlers
This commit is contained in:
@@ -30,9 +30,10 @@ jQuery(document).ready(function() {
|
||||
um_modal_responsive();
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.remove_file,
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_remove_file',
|
||||
src: src
|
||||
}
|
||||
});
|
||||
@@ -59,9 +60,10 @@ jQuery(document).ready(function() {
|
||||
um_modal_responsive();
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.remove_file,
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_remove_file',
|
||||
src: src
|
||||
}
|
||||
});
|
||||
@@ -105,10 +107,11 @@ jQuery(document).ready(function() {
|
||||
jQuery(this).html( jQuery(this).attr('data-processing') ).addClass('disabled');
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.resize_image,
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
action: 'um_resize_image',
|
||||
src : src,
|
||||
coord : coord,
|
||||
user_id : user_id,
|
||||
|
||||
@@ -43,9 +43,10 @@ jQuery(document).ready(function() {
|
||||
metakey = 'profile_photo';
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.delete_profile_photo,
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action:'um_delete_profile_photo',
|
||||
metakey: metakey,
|
||||
user_id: user_id
|
||||
}
|
||||
@@ -65,9 +66,10 @@ jQuery(document).ready(function() {
|
||||
metakey = 'cover_photo';
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.delete_cover_photo,
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_delete_cover_photo',
|
||||
metakey: metakey,
|
||||
user_id: user_id
|
||||
},
|
||||
|
||||
@@ -151,9 +151,10 @@ jQuery(document).ready(function() {
|
||||
parent.find('input[type=hidden]').val('empty_file');
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.remove_file,
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_remove_file',
|
||||
src: src
|
||||
}
|
||||
});
|
||||
@@ -170,9 +171,10 @@ jQuery(document).ready(function() {
|
||||
parent.find('input[type=hidden]').val('empty_file');
|
||||
|
||||
jQuery.ajax({
|
||||
url: um_scripts.remove_file,
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_remove_file',
|
||||
src: src
|
||||
}
|
||||
});
|
||||
@@ -247,9 +249,10 @@ jQuery(document).ready(function() {
|
||||
var hook = jQuery(this).data('hook');
|
||||
var container = jQuery(this).parents('.um').find('.um-ajax-items');
|
||||
jQuery.ajax({
|
||||
url: um_scripts.ajax_paginate,
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'um_ajax_paginate',
|
||||
hook: hook,
|
||||
args: args
|
||||
},
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
function um_upgrade_privacy2024() {
|
||||
um_maybe_unset_time_limit();
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$wpdb->query( $wpdb->prepare(
|
||||
"UPDATE {$wpdb->usermeta}
|
||||
SET meta_value = CASE
|
||||
WHEN meta_value = %s THEN 'Everyone'
|
||||
WHEN meta_value = %s THEN 'Only me'
|
||||
WHEN meta_value = %s THEN 'followed'
|
||||
WHEN meta_value = %s THEN 'follower'
|
||||
WHEN meta_value = %s THEN 'friends'
|
||||
END
|
||||
WHERE meta_key = 'profile_privacy'",
|
||||
__( 'Everyone', 'ultimate-member' ),
|
||||
__( 'Only me', 'ultimate-member' ),
|
||||
__( 'Only people I follow can view my profile', 'um-followers' ),
|
||||
__( 'Followers', 'um-followers' ),
|
||||
__( 'Friends only', 'um-friends' )
|
||||
) );
|
||||
|
||||
UM()->user()->remove_cache_all_users();
|
||||
|
||||
update_option( 'um_last_version_upgrade', '2.0.24' );
|
||||
|
||||
wp_send_json_success( array( 'message' => __( 'Privacy Settings was upgraded successfully', 'ultimate-member' ) ) );
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'privacy2024' => 'privacy2024',
|
||||
);
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
<?php ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery( document ).ready( function() {
|
||||
//upgrade styles
|
||||
um_add_upgrade_log( '<?php echo esc_js( __( 'Upgrade Privacy Settings...', 'ultimate-member' ) ) ?>' );
|
||||
|
||||
jQuery.ajax({
|
||||
url: '<?php echo admin_url( 'admin-ajax.php' ) ?>',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
action: 'um_privacy2024'
|
||||
},
|
||||
success: function( response ) {
|
||||
if ( typeof response.data != 'undefined' ) {
|
||||
um_add_upgrade_log( response.data.message );
|
||||
//switch to the next package
|
||||
um_run_upgrade();
|
||||
} else {
|
||||
um_wrong_ajax();
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
um_something_wrong();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -32,15 +32,14 @@ if ( ! class_exists( 'um\core\AJAX_Common' ) ) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
add_action( 'wp_ajax_um_remove_file', array( UM()->files(), 'ajax_remove_file' ) );
|
||||
add_action( 'wp_ajax_um_delete_profile_photo', array( UM()->profile(), 'ajax_delete_profile_photo' ) );
|
||||
add_action( 'wp_ajax_um_delete_cover_photo', array( UM()->profile(), 'ajax_delete_cover_photo' ) );
|
||||
add_action( 'wp_ajax_um_select_options', array( UM()->form(), 'ajax_select_options' ) );
|
||||
add_action( 'wp_ajax_um_ajax_paginate', array( UM()->query(), 'ajax_paginate' ) );
|
||||
add_action( 'wp_ajax_um_muted_action', array( UM()->form(), 'ajax_muted_action' ) );
|
||||
|
||||
add_action( 'wp_ajax_um_remove_file', array( UM()->files(), 'ajax_remove_file' ) );
|
||||
add_action( 'wp_ajax_nopriv_um_remove_file', array( UM()->files(), 'ajax_remove_file' ) );
|
||||
add_action( 'wp_ajax_um_remove_file', array( UM()->files(), 'ajax_remove_file' ) );
|
||||
|
||||
add_action( 'wp_ajax_nopriv_um_fileupload', array( UM()->files(), 'ajax_file_upload' ) );
|
||||
add_action( 'wp_ajax_um_fileupload', array( UM()->files(), 'ajax_file_upload' ) );
|
||||
|
||||
@@ -137,12 +137,7 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
|
||||
*/
|
||||
$localize_data = apply_filters( 'um_enqueue_localize_data', array(
|
||||
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
||||
'remove_file' => UM()->get_ajax_route( 'um\core\Files', 'ajax_remove_file' ),
|
||||
'delete_profile_photo' => UM()->get_ajax_route( 'um\core\Profile', 'ajax_delete_profile_photo' ),
|
||||
'delete_cover_photo' => UM()->get_ajax_route( 'um\core\Profile', 'ajax_delete_cover_photo' ),
|
||||
'resize_image' => UM()->get_ajax_route( 'um\core\Files', 'ajax_resize_image' ),
|
||||
'muted_action' => UM()->get_ajax_route( 'um\core\Form', 'ajax_muted_action' ),
|
||||
'ajax_paginate' => UM()->get_ajax_route( 'um\core\Query', 'ajax_paginate' ),
|
||||
'ajax_select_options' => UM()->get_ajax_route( 'um\core\Form', 'ajax_select_options' ),
|
||||
) );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user