- fixed get_meta_value function for options with "0" value;

- fixed upgrade to 2.0 for transferring menu restriction;
This commit is contained in:
nikitozzzzzzz
2017-08-30 16:01:43 +03:00
parent e848301fa9
commit 1f5bf3dafc
5 changed files with 63 additions and 17 deletions
+29 -1
View File
@@ -1166,4 +1166,32 @@ foreach ( $emails as $email_key => $value ) {
}
}
}
}
}
/**
* Transferring menu restriction data
*/
$menus = get_posts( array(
'post_type' => 'nav_menu_item',
'meta_query' => array(
array(
'key' => 'menu-item-um_nav_roles',
'compare' => 'EXISTS',
)
)
) );
foreach ( $menus as $menu ) {
$menu_roles = get_post_meta( $menu->ID, 'menu-item-um_nav_roles', true );
$menu_roles = array_map( function( $item ) {
if ( strpos( $item, 'um_' ) === 0 )
return $item;
return 'um_' . $item;
}, $menu_roles );
update_post_meta( $menu->ID, 'menu-item-um_nav_roles', $menu_roles );
}
@@ -53,10 +53,14 @@
),
array(
'id' => '_um_login_secondary_btn',
'type' => 'checkbox',
'type' => 'select',
'label' => __( 'Show Secondary Button', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_login_secondary_btn', null, 1 ),
'conditional' => array( '_um_login_use_custom_settings', '=', 1 )
'value' => UM()->query()->get_meta_value( '_um_login_secondary_btn', null, um_get_option( 'login_secondary_btn' ) ),
'conditional' => array( '_um_login_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
array(
'id' => '_um_login_secondary_btn_word',
@@ -77,12 +77,16 @@
),
array(
'id' => '_um_profile_secondary_btn',
'type' => 'checkbox',
'type' => 'select',
'label' => __( 'Show Secondary Button', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_secondary_btn', null, 1 ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 )
'value' => UM()->query()->get_meta_value( '_um_profile_secondary_btn', null, um_get_option( 'profile_secondary_btn' ) ),
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
array(
array(
'id' => '_um_profile_secondary_btn_word',
'type' => 'text',
'label' => __( 'Primary Button Text', 'ultimate-member' ),
@@ -68,10 +68,14 @@
),
array(
'id' => '_um_register_secondary_btn',
'type' => 'checkbox',
'type' => 'select',
'label' => __( 'Show Secondary Button', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_register_secondary_btn', null, 1 ),
'conditional' => array( '_um_register_use_custom_settings', '=', 1 )
'value' => UM()->query()->get_meta_value( '_um_register_secondary_btn', null, um_get_option( 'register_secondary_btn' ) ),
'conditional' => array( '_um_register_use_custom_settings', '=', 1 ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
array(
'id' => '_um_register_secondary_btn_word',