mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-12 03:06:23 +09:00
Merge remote-tracking branch 'remotes/origin/fix_last_login_field'
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
function um_upgrade_fields2043() {
|
||||
UM()->admin()->check_ajax_nonce();
|
||||
|
||||
um_maybe_unset_time_limit();
|
||||
|
||||
include 'metafields.php';
|
||||
|
||||
update_option( 'um_last_version_upgrade', '2.0.43' );
|
||||
|
||||
wp_send_json_success( array( 'message' => __( 'Field was upgraded successfully', 'ultimate-member' ) ) );
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'fields2043' => 'fields2043',
|
||||
);
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?php ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery( document ).ready( function() {
|
||||
//upgrade styles
|
||||
um_add_upgrade_log( '<?php echo esc_js( __( 'Upgrade predefined metafields...', 'ultimate-member' ) ) ?>' );
|
||||
|
||||
jQuery.ajax({
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
action: 'um_fields2043',
|
||||
nonce: um_admin_scripts.nonce
|
||||
},
|
||||
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>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
$forms_query = new WP_Query;
|
||||
$profile_forms = $forms_query->query( array(
|
||||
'post_type' => 'um_form',
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => '_um_mode',
|
||||
'value' => 'profile'
|
||||
),
|
||||
),
|
||||
'posts_per_page' => -1,
|
||||
'fields' => 'ids'
|
||||
) );
|
||||
|
||||
foreach ( $profile_forms as $form_id ) {
|
||||
$profile_forms_fields = get_post_meta( $form_id, '_um_custom_fields', true );
|
||||
|
||||
foreach ( $profile_forms_fields as $key => $field ){
|
||||
|
||||
if( isset( $field['metakey'] ) ){
|
||||
$metakey = $field['metakey'];
|
||||
if ( $key != $metakey ){
|
||||
$profile_forms_fields[$metakey] = $profile_forms_fields[$key];
|
||||
unset($profile_forms_fields[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
update_post_meta( $form_id, '_um_custom_fields', $profile_forms_fields );
|
||||
}
|
||||
@@ -663,6 +663,11 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
'Only me' => __( 'Only me', 'ultimate-member' )
|
||||
) );
|
||||
|
||||
/*
|
||||
* it's important create key for array equals value of 'metakey'.
|
||||
*
|
||||
*/
|
||||
|
||||
$this->predefined_fields = array(
|
||||
|
||||
'user_login' => array(
|
||||
@@ -755,7 +760,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
'edit_forbidden' => 1,
|
||||
),
|
||||
|
||||
'last_login' => array(
|
||||
'_um_last_login' => array(
|
||||
'title' => __('Last Login','ultimate-member'),
|
||||
'metakey' => '_um_last_login',
|
||||
'type' => 'text',
|
||||
@@ -980,7 +985,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
'match' => 'https://soundcloud.com/',
|
||||
),
|
||||
|
||||
'vk' => array(
|
||||
'vkontakte' => array(
|
||||
'title' => __('VKontakte','ultimate-member'),
|
||||
'metakey' => 'vkontakte',
|
||||
'type' => 'url',
|
||||
|
||||
Reference in New Issue
Block a user