Support » Fixing WordPress » editing timestamps as user level < 5 PART 2

  • Resolved WindyT


    As seen here

    I have the same issue on a multi-author blog. Level 5 and above users can edit the timestamps.

    All the authors are at level below 5, and we’d like to keep them there except for editing their time stamps.

    We WANT their posts to go up at a particular time, and we want their posts submitted early.

    The referenced support topic
    didn’t work for me. Was this only working for a previous version of WordPress, and not for the current 1.5+?

    I’m going to restore the file to their original state, promote the users temporarily and look for a fix with you fine folks.

    Any help with this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Kafkaesqui


    For 1.5.x you have to change the $user_level comparison value in edit-form-advanced.php:

    <?php if ($user_level > 4) : ?>
    <th scope="row"><?php _e('Edit time'); ?>:</th>
    <td><?php touch_time(($action == 'edit')); ?></td>
    <?php endif; ?>

    Then make the same mod for $author_data->user_level in a couple of functions found in functions-post.php (wp-includes/ directory):

    function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
    $author_data = get_userdata($user_id);
    return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));

    function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
    $author_data = get_userdata($user_id);
    return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));

    Hacking note: back up source files before editing, and comment your changes for future reference.



    Looks like it worked!

    With a different author every day, I was under the gun to get this working correctly.

    Thank you!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘editing timestamps as user level < 5 PART 2’ is closed to new replies.