mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed get_meta_value function for options with "0" value;
- fixed upgrade to 2.0 for transferring menu restriction;
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user