Editing post when author is user_level == 0
-
I’ve been using feedwordpress to import external RSS feeds into my local WordPress database. Sometimes, I need to tweak the posts manually, but when I do so, the author is changed to me because the original author is copied from the RSS feed, and created as a user_level 0 user (who cannot be an author).
I created a patch for edit-form-advanced to let me preserve the original author in the case that the original author is user_level 0.
— edit-form-advanced.php.orig Mon Apr 4 22:16:30 2005
+++ edit-form-advanced.php Mon Apr 4 22:27:49 2005
@@ -150,7 +150,7 @@
<th scope=”row” width=”25%”><?php _e(‘Post slug’) ?>:</th>
<td><input name=”post_name” type=”text” size=”25″ id=”post_name” value=”<?php echo $post_name ?>” /></td>
</tr>
-<?php if ($user_level > 7 && $users = $wpdb->get_results(“SELECT ID, user_login, user_firstname, user_lastname FROM $wpdb->users WHERE user_level <= $user_level AND user_level > 0”) ) : ?>
+<?php if ($user_level > 7 && $users = $wpdb->get_results(“SELECT ID, user_login, user_firstname, user_lastname, user_level FROM $wpdb->users WHERE user_level <= $user_level”) ) : ?>
<tr>
<th scope=”row”><?php _e(‘Post author’); ?>:</th>
<td>
@@ -159,7 +159,8 @@
foreach ($users as $o) :
if ( $post_author == $o->ID ) $selected = ‘selected=”selected”‘;
else $selected = ”;
– echo “<option value=’$o->ID’ $selected>$o->user_login ($o->user_firstname $o->user_lastname)</option>”;
+ if ($selected != “” || $o->user_level > 0)
+ echo “<option value=’$o->ID’ $selected>$o->user_login ($o->user_firstname $o->user_lastname)</option>”;
endforeach;
?>
</select>
@@ -201,4 +202,4 @@
?>
</div>-</form>
\ No newline at end of file
+</form>
The topic ‘Editing post when author is user_level == 0’ is closed to new replies.