Make WordPress Core

Changeset 2709


Ignore:
Timestamp:
07/13/2005 10:26:26 PM (21 years ago)
Author:
ryan
Message:

Migrate to caps.

Location:
trunk/wp-admin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-functions.php

    r2705 r2709  
    498498    <td><?php echo mysql2date('Y-m-d g:i a', $post->post_modified); ?></td>
    499499    <td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
    500     <td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
    501     <td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'OK\' to delete, \'Cancel\' to stop."), the_title('','',0)) . "')\">" . __('Delete') . "</a>"; } ?></td>
     500    <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
     501    <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'OK\' to delete, \'Cancel\' to stop."), the_title('','',0)) . "')\">" . __('Delete') . "</a>"; } ?></td>
    502502  </tr>
    503503
  • trunk/wp-admin/edit-form-advanced.php

    r2702 r2709  
    156156if ('publish' != $post_status || 0 == $post_ID) {
    157157?>
    158 <?php if ( user_can_create_post($user_ID) ) : ?>
     158<?php if ( current_user_can('publish_posts') ) : ?>
    159159    <input name="publish" type="submit" id="publish" tabindex="10" value="<?php _e('Publish') ?>" />
    160160<?php endif; ?>
  • trunk/wp-admin/edit.php

    r2701 r2709  
    199199    case 'control_edit':
    200200        ?>
    201         <td><?php if ( user_can_edit_post($user_ID,$post->ID) ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
     201        <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
    202202        <?php
    203203        break;
     
    205205    case 'control_delete':
    206206        ?>
    207         <td><?php if ( user_can_edit_post($user_ID,$post->ID) ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'OK\' to delete, \'Cancel\' to stop."), wp_specialchars(get_the_title('', ''), 1) ) . "')\">" . __('Delete') . "</a>"; } ?></td>
     207        <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'OK\' to delete, \'Cancel\' to stop."), wp_specialchars(get_the_title('', ''), 1) ) . "')\">" . __('Delete') . "</a>"; } ?></td>
    208208        <?php
    209209        break;
  • trunk/wp-admin/post.php

    r2703 r2709  
    7070        die ( __('You are not allowed to edit this post.') );
    7171
    72     if ( !user_can_edit_post($user_ID, $post_ID) )
    73         die ( __('You are not allowed to view other users\' private posts.') );     
    74 
    7572    $post = get_post_to_edit($post_ID);
    7673   
     
    121118    $post_id = (isset($_GET['post']))  ? intval($_GET['post']) : intval($_POST['post_ID']);
    122119   
    123     if (!user_can_delete_post($user_ID, $post_id)) {
     120    if ( !current_user_can('edit_post', $post_id) )
    124121        die( __('You are not allowed to delete this post.') );
    125     }
    126122
    127123    if (! wp_delete_post($post_id))
     
    146142        die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)'));
    147143
    148     if ( !user_can_edit_post_comments($user_ID, $comment->comment_post_ID) )
     144    if ( !current_user_can('edit_post', $comment->comment_post_ID) )   
    149145        die( __('You are not allowed to edit comments on this post.') );
    150146
     
    165161        die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
    166162
    167     if ( !user_can_delete_post_comments($user_ID, $comment->comment_post_ID) )
     163    if ( !current_user_can('edit_post', $comment->comment_post_ID) )   
    168164        die( __('You are not allowed to delete comments on this post.') );
    169165
     
    208204             die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php'));
    209205
    210     if (!user_can_delete_post_comments($user_ID, $commentdata['comment_post_ID']))
     206    if ( !current_user_can('edit_post', $comment->comment_post_ID) )   
    211207        die( __('You are not allowed to edit comments on this post.') );
    212208
     
    239235        die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
    240236
    241     if ( !user_can_edit_post_comments($user_ID, $comment->comment_post_ID) )
     237    if ( !current_user_can('edit_post', $comment->comment_post_ID) )   
    242238        die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
    243239
     
    259255             die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
    260256
    261     if ( !user_can_edit_post_comments($user_ID, $comment->comment_post_ID) )
     257    if ( !current_user_can('edit_post', $comment->comment_post_ID) )   
    262258        die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
    263259
     
    285281        die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
    286282
    287     if ( !user_can_edit_post_comments($user_ID, $commentdata['comment_post_ID']))
     283    if ( !current_user_can('edit_post', $comment->comment_post_ID) )   
    288284        die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
    289285
     
    323319<?php endif; ?>
    324320<?php
    325     if ( user_can_create_draft($user_ID) ) {
     321    if ( current_user_can('edit_posts') ) {
    326322        $action = 'post';
    327323        get_currentuserinfo();
Note: See TracChangeset for help on using the changeset viewer.