Version 1.0.27

This commit is contained in:
ultimatemember
2015-01-27 01:52:11 +02:00
parent adebeee3d5
commit 31dc7962bf
7 changed files with 77 additions and 10 deletions
+30 -2
View File
@@ -60,7 +60,27 @@ class UM_Admin_Access {
***/
function load_metabox_form( $object, $box ) {
global $ultimatemember, $post;
include_once um_path . 'admin/templates/access/settings.php';
$box['id'] = str_replace('um-admin-access-','', $box['id']);
if ( $box['id'] == 'builder' ) {
$UM_Builder = new UM_Admin_Builder();
$UM_Builder->form_id = get_the_ID();
}
preg_match('#\{.*?\}#s', $box['id'], $matches);
if ( isset($matches[0]) ){
$path = $matches[0];
$box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] );
} else {
$path = um_path;
}
$path = str_replace('{','', $path );
$path = str_replace('}','', $path );
include_once $path . 'admin/templates/access/'. $box['id'] . '.php';
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_access_nonce' );
}
@@ -72,7 +92,9 @@ class UM_Admin_Access {
$types = get_post_types();
foreach($types as $post_type) {
if ( $this->core_post_type( $post_type ) ) return;
add_meta_box('um-admin-access-control', __('Access Control'), array(&$this, 'load_metabox_form'), $post_type, 'side', 'default');
add_meta_box('um-admin-access-settings', __('Access Control'), array(&$this, 'load_metabox_form'), $post_type, 'side', 'default');
do_action('um_admin_custom_access_metaboxes');
}
}
@@ -91,6 +113,12 @@ class UM_Admin_Access {
if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id;
// save
$multi_choice_keys = apply_filters('um_admin_multi_choice_keys', array() );
if ( $multi_choice_keys ) {
foreach( $multi_choice_keys as $k ) {
delete_post_meta( $post_id, $k );
}
}
foreach( $_POST as $k => $v ) {
if (strstr($k, '_um_')){
update_post_meta( $post_id, $k, $v);