Use the edit_others_posts capability for controlling sticky checkbox display and usage. see #7457

git-svn-id: http://svn.automattic.com/wordpress/trunk@8577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2008-08-06 21:31:40 +00:00
parent bc5419ac4f
commit ce1404129e
2 changed files with 9 additions and 5 deletions

View File

@ -118,7 +118,9 @@ if ( current_user_can('publish_posts') OR ( $post->post_status == 'publish' AND
<?php if ( current_user_can( 'publish_posts' ) ) : ?> <?php if ( current_user_can( 'publish_posts' ) ) : ?>
<p id="private-checkbox"><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label></p> <p id="private-checkbox"><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label></p>
<p id="sticky-checkbox"><label for="sticky" class="selectit"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID), true); ?> tabindex="4" /> <?php _e('Stick this post to the front page') ?></label></p> <?php if ( current_user_can( 'edit_others_posts' ) ) : ?>
<p id="sticky-checkbox"><label for="sticky" class="selectit"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID), true); ?> tabindex="4" /> <?php _e('Stick this post to the front page') ?></label></p>
<?php endif; ?>
<?php endif; ?> <?php endif; ?>
<?php <?php
if ($post_ID) { if ($post_ID) {

View File

@ -161,10 +161,12 @@ function edit_post() {
wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID ); wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID );
if ( !empty($_POST['sticky']) ) if ( current_user_can( 'edit_others_posts' ) ) {
stick_post($post_ID); if ( !empty($_POST['sticky']) )
else stick_post($post_ID);
unstick_post($post_ID); else
unstick_post($post_ID);
}
return $post_ID; return $post_ID;
} }