• milez

    (@milez)


    I am using Role Manager on my WP 2.1.1 blog and contributors are requesting the ability read the drafts of others to make sure they are not writing about the same topics. I have scoured the web and this forum and cannot figure out how to allow this.

    The allowable actions for Contributors are: Delete Posts, Edit Published Posts, Read, Upload Files, and Edit Posts. user Level is 1. I even tried adding a test user to the Authors role which is user level 2 but that didn’t work either.

    I am starting to think that editting the function in admin-db.php that handles this is the only way to do it, but maybe I am missing something obvious. here is the function if anyone is willing to help, I think it would help a LOT of WP users:

    function get_others_drafts( $user_id ) {
    	global $wpdb;
    	$user = get_userdata( $user_id );
    	$level_key = $wpdb->prefix . 'user_level';
    
    	$editable = get_editable_user_ids( $user_id );
    
    	if( !$editable ) {
    		$other_drafts = '';
    	} else {
    		$editable = join(',', $editable);
    		$other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author IN ($editable) AND post_author != '$user_id' ");
    	}
    
    	return apply_filters('get_others_drafts', $other_drafts);
    }
Viewing 1 replies (of 1 total)
  • Thread Starter milez

    (@milez)

    The answer is to change this line:

    $other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author IN ($editable) AND post_author != '$user_id' ");

    to:

    $other_drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author != '$user_id' ");

    Anyone see a problem with this?

Viewing 1 replies (of 1 total)
  • The topic ‘Contributors able to view ALL drafts’ is closed to new replies.