WP网站的超级编辑/超级作者?

时间:2013-10-14 21:30:12

标签: wordpress

我正在开发一个包含许多网站的WP网络,所有这些网站都将由同一大群用户编辑。我非常希望不给所有这些用户提供超级管理员权限,所以我想知道是否可以创建一个“超级编辑器”角色/用户组,允许用户编辑/创作所有用户网络中的网站,但无法实际管理网络等。

我找到了允许克隆博客和将用户从一个博客复制到另一个博客的插件,但是能够简单地创建一次用户并为他们提供适当的网络范围的权限,并且类似地从用户删除一次网络撤销私人。

任何线索?我的Google-Fu在这个上失败了。

提前致谢!

2 个答案:

答案 0 :(得分:1)

将此代码粘贴到您的主题function.php文件中,并根据需要进行自定义。

/* Add member role to the site */
add_role('member', 'Member', array(
    'read' => true,
    'edit_posts' => true,
    'delete_posts' => true,
));

/* Add snypher role to the site */
add_role('snypher', 'Snypher', array(
    'read' => true,
    'edit_posts' => true,
    'delete_posts' => true,
));

/* remove the unnecessary roles */
remove_role('subscriber');
remove_role('editor');
remove_role('author');
remove_role('contributor');

希望这两个链接可以为您提供更多帮助:

[1] http://codex.wordpress.org/Function_Reference/add_role

[2] http://codex.wordpress.org/Function_Reference/add_cap

感谢。

答案 1 :(得分:0)

根据Krunai Shah的回答,创建一个具有多种权力的自定义角色。然后创建一个Must Use插件,根据您的需要调整following code

<?
/**
 * Plugin Name: Network Access
 */

/**
  * Redirect Authors and Subscribers to the site front page
  * Except if viewing the Profile page
  */
add_action('admin_init','wpse_53675_block_users');
function wpse_53675_block_users()
{
    global $pagenow;
    if( 'profile.php' == $pagenow ) // use in_array to put a bunch of prohibited pages
        return;

    if( !current_user_can('delete_pages') ) 
    {   
        wp_redirect( get_home_url(), 301 ); 
        exit;
    }
}

/**
 * Hide all menus from the Admin panel
 * Except the profile item
 */
add_action('admin_menu', 'wpse_53675_remove_admin_menus', 999);
function wpse_53675_remove_admin_menus() {
    if( !current_user_can('delete_pages') ) 
    {
        remove_menu_page('index.php');
        remove_menu_page('edit.php');
        remove_menu_page('upload.php');
        remove_menu_page('link-manager.php');
        remove_menu_page('edit.php?post_type=page');
        remove_menu_page('edit-comments.php');
        remove_menu_page('tools.php');
    }
}

有用的Q&A: How to adapt my plugin to Multisite?