Make WordPress Core

Changeset 11447


Ignore:
Timestamp:
05/24/2009 06:46:01 PM (15 years ago)
Author:
westi
Message:

Hide options from users when they don't make any sense for them. Fixes #8433 props Denis-de-Bernardy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/user-edit.php

    r11383 r11447  
    4040}
    4141
     42$all_post_types = apply_filters('all_post_types', array('post', 'page'));
     43$user_can_edit = false;
     44foreach ( $all_post_types as $post_type )
     45    $user_can_edit |= current_user_can("edit_$post_type");
     46
    4247/**
    4348 * Optional SSL preference that can be turned on by hooking to the 'personal_options' action.
     
    131136
    132137<table class="form-table">
    133 <?php if ( rich_edit_exists() ) : // don't bother showing the option if the editor has been removed ?>
     138<?php if ( rich_edit_exists() && !( IS_PROFILE_PAGE && !$user_can_edit ) ) : // don't bother showing the option if the editor has been removed ?>
    134139    <tr>
    135140        <th scope="row"><?php _e('Visual Editor')?></th>
     
    160165</fieldset></td>
    161166</tr>
     167<?php if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
    162168<tr>
    163169<th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
     
    165171</tr>
    166172<?php
     173endif;
    167174endif;
    168175do_action('personal_options', $profileuser);
Note: See TracChangeset for help on using the changeset viewer.