mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 11:35:48 +00:00
Hide options from users when they don't make any sense for them. Fixes #8433 props Denis-de-Bernardy.
git-svn-id: http://svn.automattic.com/wordpress/trunk@11447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
084280b76e
commit
8a6eacda08
@ -39,6 +39,11 @@ if ( !$user_id ) {
|
|||||||
wp_die( __('Invalid user ID.') );
|
wp_die( __('Invalid user ID.') );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$all_post_types = apply_filters('all_post_types', array('post', 'page'));
|
||||||
|
$user_can_edit = false;
|
||||||
|
foreach ( $all_post_types as $post_type )
|
||||||
|
$user_can_edit |= current_user_can("edit_$post_type");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional SSL preference that can be turned on by hooking to the 'personal_options' action.
|
* Optional SSL preference that can be turned on by hooking to the 'personal_options' action.
|
||||||
*
|
*
|
||||||
@ -130,7 +135,7 @@ include ('admin-header.php');
|
|||||||
<h3><?php _e('Personal Options'); ?></h3>
|
<h3><?php _e('Personal Options'); ?></h3>
|
||||||
|
|
||||||
<table class="form-table">
|
<table class="form-table">
|
||||||
<?php if ( rich_edit_exists() ) : // don't bother showing the option if the editor has been removed ?>
|
<?php if ( rich_edit_exists() && !( IS_PROFILE_PAGE && !$user_can_edit ) ) : // don't bother showing the option if the editor has been removed ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><?php _e('Visual Editor')?></th>
|
<th scope="row"><?php _e('Visual Editor')?></th>
|
||||||
<td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php checked('false', $profileuser->rich_editing); ?> /> <?php _e('Disable the visual editor when writing'); ?></label></td>
|
<td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php checked('false', $profileuser->rich_editing); ?> /> <?php _e('Disable the visual editor when writing'); ?></label></td>
|
||||||
@ -159,12 +164,14 @@ foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</fieldset></td>
|
</fieldset></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
|
<th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
|
||||||
<td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( !empty($profileuser->comment_shortcuts) ) checked('true', $profileuser->comment_shortcuts); ?> /> <?php _e('Enable keyboard shortcuts for comment moderation. '); ?></label><?php _e('<a href="http://codex.wordpress.org/Keyboard_Shortcuts">More information</a>'); ?></td>
|
<td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( !empty($profileuser->comment_shortcuts) ) checked('true', $profileuser->comment_shortcuts); ?> /> <?php _e('Enable keyboard shortcuts for comment moderation. '); ?></label><?php _e('<a href="http://codex.wordpress.org/Keyboard_Shortcuts">More information</a>'); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
|
endif;
|
||||||
do_action('personal_options', $profileuser);
|
do_action('personal_options', $profileuser);
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user