2013-08-24 2 views
1

어떤 사람이 자신의 게시물 만 편집하도록 사용자를 제한 할 수 있습니까? 나는 역할 편집기 플러그인을 사용했지만 사용자가 모든 사용자를 편집 할 수 있도록 허용합니다. 사용자가 게시 할 수있는 분류 된 사이트 플러그인 (사용자 정의 게시 유형)과 게시를 편집 할 수 있습니다.어떻게 워드 프레스에서 사용자를 제한 할 수 있습니까?

+0

역할 편집기 플러그인, –

+0

방금 ​​사용자 관리 페이지에서 작성하는 사용자의 역할을 설정할 수 없습니다 작동합니다 :-) 당신을 도와줍니다? Codex의 [Roles and Capabilities] (http://codex.wordpress.org/Roles_and_Capabilities#Summary_of_Roles) 페이지에 따르면 원하는대로 할 수 있습니다. – Hobo

+0

@ 호보 나는 이미 그것을 시험해 보았지만 행운은 당신에게 나에게 모범을 보일 수는 없다. –

답변

0

이 코드를 사용하여 자신의 게시물 만 편집하도록 사용자를 제한 할 수 있습니다.

function my_authored_content($query) { 

//get current user info to see if they are allowed to access ANY posts and pages 
$current_user = wp_get_current_user(); 
// set current user to $is_user 
$is_user = $current_user->user_login; 

//if is admin or 'is_user' does not equal #username 
if (!current_user_can('manage_options')){ 
    //if in the admin panel 
    if($query->is_admin) { 

     global $user_ID; 
     $query->set('author', $user_ID); 

    } 
    return $query; 
} 
return $query; 
} 
add_filter('pre_get_posts', 'my_authored_content'); 

function remove_menu_items() { 
$current_user = wp_get_current_user(); 
if (!current_user_can('manage_options')) { 
    //hides comments menu 
    remove_menu_page('edit-comments.php'); 
    // hides posts menu 
    remove_menu_page('edit.php'); 
    hides pages menu 
    remove_menu_page('edit.php?post_type=page'); 
} 
} 
add_action('admin_menu', 'remove_menu_items'); 

희망이

관련 문제