Move the admin bar profile preferences to a hook. fixes #16004.

git-svn-id: http://svn.automattic.com/wordpress/trunk@17161 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-12-28 19:37:11 +00:00
parent 0630489d88
commit a92b6663aa
2 changed files with 24 additions and 11 deletions

View File

@ -212,17 +212,6 @@ if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
<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" target="_blank">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" target="_blank">More information</a>'); ?></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<tr>
<th scope="row"><?php _e('Show Admin Bar')?></th>
<td><fieldset><legend class="screen-reader-text"><span><?php _e('Show Admin Bar') ?></span></legend>
<label for="admin_bar_front">
<input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1" <?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> />
<?php /* translators: Show admin bar when viewing site */ _e( 'when viewing site' ); ?></label><br />
<label for="admin_bar_admin">
<input name="admin_bar_admin" type="checkbox" id="admin_bar_admin" value="1" <?php checked( _get_admin_bar_pref( 'admin', $profileuser->ID ) ); ?> />
<?php /* translators: Show admin bar in dashboard */ _e( 'in dashboard' ); ?></label>
</td>
</tr>
<?php do_action('personal_options', $profileuser); ?> <?php do_action('personal_options', $profileuser); ?>
</table> </table>
<?php <?php

View File

@ -359,4 +359,28 @@ function _get_admin_bar_pref( $context, $user = 0 ) {
return 'true' === $pref; return 'true' === $pref;
} }
/**
* Add the admin bar display preferences to user profiles.
*
* @since 3.1.0
* @access private
*/
function _admin_bar_preferences( $profileuser ) {
?>
<tr>
<th scope="row"><?php _e('Show Admin Bar')?></th>
<td><fieldset><legend class="screen-reader-text"><span><?php _e('Show Admin Bar') ?></span></legend>
<label for="admin_bar_front">
<input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1" <?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> />
<?php /* translators: Show admin bar when viewing site */ _e( 'when viewing site' ); ?></label><br />
<label for="admin_bar_admin">
<input name="admin_bar_admin" type="checkbox" id="admin_bar_admin" value="1" <?php checked( _get_admin_bar_pref( 'admin', $profileuser->ID ) ); ?> />
<?php /* translators: Show admin bar in dashboard */ _e( 'in dashboard' ); ?></label>
</td>
</tr>
<?php
}
add_action( 'personal_options', '_admin_bar_preferences' );
?> ?>