Fix metabox hiding. Props scribu. fixes #12439
git-svn-id: http://svn.automattic.com/wordpress/trunk@13551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b37894c348
commit
95623b4ce5
|
@ -1021,11 +1021,11 @@ case 'closed-postboxes' :
|
|||
die('-1');
|
||||
|
||||
if ( is_array($closed) )
|
||||
update_user_meta($user->ID, 'closedpostboxes_'.$page, $closed);
|
||||
update_user_option($user->ID, "closedpostboxes_$page", $closed);
|
||||
|
||||
if ( is_array($hidden) ) {
|
||||
$hidden = array_diff( $hidden, array('submitdiv', 'linksubmitdiv') ); // postboxes that are always shown
|
||||
update_user_meta($user->ID, 'meta-box-hidden_'.$page, $hidden);
|
||||
update_user_option($user->ID, "meta-box-hidden_$page", $hidden);
|
||||
}
|
||||
|
||||
die('1');
|
||||
|
@ -1043,7 +1043,7 @@ case 'hidden-columns' :
|
|||
die('-1');
|
||||
|
||||
if ( is_array($hidden) )
|
||||
update_user_meta($user->ID, "manage-$page-columns-hidden", $hidden);
|
||||
update_user_option($user->ID, "manage-$page-columns-hidden", $hidden);
|
||||
|
||||
die('1');
|
||||
break;
|
||||
|
@ -1063,7 +1063,7 @@ case 'meta-box-order':
|
|||
update_user_option($user->ID, "meta-box-order_$page", $order);
|
||||
|
||||
if ( $page_columns )
|
||||
update_user_meta($user->ID, "screen_layout_$page", $page_columns);
|
||||
update_user_option($user->ID, "screen_layout_$page", $page_columns);
|
||||
|
||||
die('1');
|
||||
break;
|
||||
|
|
|
@ -34,8 +34,17 @@ $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
|
|||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
|
||||
var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time() ?>'};
|
||||
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = '<?php echo substr($pagenow, 0, -4); ?>', typenow = '<?php echo $typenow; ?>', adminpage = '<?php echo $admin_body_class; ?>', thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>', decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>';
|
||||
var userSettings = {
|
||||
'url': '<?php echo SITECOOKIEPATH; ?>',
|
||||
'uid': '<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>',
|
||||
'time':'<?php echo time() ?>'
|
||||
},
|
||||
ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>',
|
||||
pagenow = '<?php echo $current_screen->id; ?>',
|
||||
typenow = '<?php if ( isset($current_screen->post_type) ) echo $current_screen->post_type; ?>',
|
||||
adminpage = '<?php echo $admin_body_class; ?>',
|
||||
thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
|
||||
decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>';
|
||||
//]]>
|
||||
</script>
|
||||
<?php
|
||||
|
|
|
@ -228,17 +228,9 @@ WPRemoveThumbnail = function(){
|
|||
})(jQuery);
|
||||
|
||||
jQuery(document).ready( function($) {
|
||||
var stamp, visibility, sticky = '', post = 'post' == pagenow || 'post-new' == pagenow, page = 'page' == pagenow || 'page-new' == pagenow;
|
||||
var stamp, visibility, sticky = '';
|
||||
|
||||
// postboxes
|
||||
if ( post ) {
|
||||
type = 'post';
|
||||
if ( typenow )
|
||||
type = typenow;
|
||||
postboxes.add_postbox_toggles(type);
|
||||
} else if ( page ) {
|
||||
postboxes.add_postbox_toggles('page');
|
||||
}
|
||||
postboxes.add_postbox_toggles(pagenow);
|
||||
|
||||
// multi-taxonomies
|
||||
if ( $('#tagsdiv-post_tag').length ) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5,6 +5,7 @@ var postboxes;
|
|||
this.init(page,args);
|
||||
$('.postbox h3, .postbox .handlediv').click( function() {
|
||||
var p = $(this).parent('.postbox'), id = p.attr('id');
|
||||
|
||||
p.toggleClass('closed');
|
||||
postboxes.save_state(page);
|
||||
if ( id ) {
|
||||
|
@ -19,6 +20,7 @@ var postboxes;
|
|||
} );
|
||||
$('.hide-postbox-tog').click( function() {
|
||||
var box = $(this).val();
|
||||
|
||||
if ( $(this).attr('checked') ) {
|
||||
$('#' + box).show();
|
||||
if ( $.isFunction( postboxes.pbshow ) )
|
||||
|
@ -115,7 +117,8 @@ var postboxes;
|
|||
|
||||
save_state : function(page) {
|
||||
var closed = $('.postbox').filter('.closed').map(function() { return this.id; }).get().join(','),
|
||||
hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
|
||||
hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
|
||||
|
||||
$.post(ajaxurl, {
|
||||
action: 'closed-postboxes',
|
||||
closed: closed,
|
||||
|
@ -127,6 +130,7 @@ var postboxes;
|
|||
|
||||
save_order : function(page) {
|
||||
var postVars, page_columns = $('.columns-prefs input:checked').val() || 0;
|
||||
|
||||
postVars = {
|
||||
action: 'meta-box-order',
|
||||
_ajax_nonce: $('#meta-box-order-nonce').val(),
|
||||
|
|
|
@ -203,7 +203,6 @@ function get_user_option( $option, $user = 0, $deprecated = '' ) {
|
|||
if ( !empty( $deprecated ) )
|
||||
_deprecated_argument( __FUNCTION__, '3.0' );
|
||||
|
||||
$option = preg_replace('|[^a-z0-9_]|i', '', $option);
|
||||
if ( empty($user) )
|
||||
$user = wp_get_current_user();
|
||||
else
|
||||
|
@ -237,6 +236,7 @@ function get_user_option( $option, $user = 0, $deprecated = '' ) {
|
|||
*/
|
||||
function update_user_option( $user_id, $option_name, $newvalue, $global = false ) {
|
||||
global $wpdb;
|
||||
|
||||
if ( !$global )
|
||||
$option_name = $wpdb->prefix . $option_name;
|
||||
return update_user_meta( $user_id, $option_name, $newvalue );
|
||||
|
@ -666,4 +666,4 @@ function clean_user_cache($id) {
|
|||
wp_cache_delete($user->user_nicename, 'userslugs');
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue