Commit c801678a by Cyrille37

hide some widgets #66

parent 88b0b3c5
......@@ -49,10 +49,11 @@ class CommunityProject
if( is_admin() )
{
add_action( 'admin_menu', array( $this, 'remove_meta_boxes' ) );
add_action( 'admin_menu', array( $this, 'redirect_if_not_author' ) );
add_action( 'admin_menu', array( $this, 'remove_meta_boxes' ) );
add_action( 'do_meta_boxes', array( $this, 'remove_edit_flow_metabox' ) );
add_filter('screen_options_show_screen', array( $this, 'remove_screen_options_tab' ) );
add_action( 'save_post', array( $this, 'set_default_status' ) );
......@@ -121,25 +122,45 @@ class CommunityProject
*/
function remove_meta_boxes()
{
if ( ! current_user_can( 'publish_posts' ) )
{
remove_meta_box( 'commentstatusdiv','project', 'normal' );
remove_meta_box( 'commentsdiv','project','normal' );
remove_meta_box( 'statusdiv','project','normal' );
remove_meta_box( 'authordiv','project','normal' );
remove_meta_box( 'slugdiv','project','normal' );
remove_meta_box( 'tagsdiv-post_tag','project','normal' );
// TODO: marche pas ...
// https://framagit.org/Artefacts/CommunityVoice/issues/66
remove_meta_box( 'wpseo_meta','project','normal' );
}
if( UserRoleController::isStudent() || ! current_user_can( 'publish_posts' ) )
{
//remove_meta_box( 'wpseo-dashboard-overview','project','normal' );
remove_meta_box( 'commentstatusdiv','project', 'normal' );
remove_meta_box( 'commentsdiv','project','normal' );
remove_meta_box( 'statusdiv','project','normal' );
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
remove_meta_box( 'dashboard_secondary', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_activity', 'dashboard', 'normal');//since 3.8
remove_meta_box( 'themeisle', 'dashboard', 'normal');//since 3.8
remove_meta_box( 'logincust_subscribe_widget', 'dashboard', 'normal');//since 3.8
}
}
function remove_edit_flow_metabox()
{
if( ! current_user_can( 'publish_posts' ) && get_post()->post_author != get_current_user_id() )
if( UserRoleController::isStudent() || ! current_user_can( 'publish_posts' ) )
{
remove_meta_box( 'wpseo_meta','project','normal' );
remove_meta_box( 'commentstatusdiv','project', 'normal' );
remove_meta_box( 'commentsdiv','project','normal' );
remove_meta_box( 'statusdiv','project','normal' );
remove_meta_box( 'authordiv','project','normal' );
remove_meta_box( 'slugdiv','project','normal' );
remove_meta_box( 'tagsdiv-post_tag','project','normal' );
}
if( ! current_user_can( 'publish_posts' ) && get_post()->post_author != get_current_user_id() )
{
remove_meta_box( 'edit-flow-editorial-comments','project','normal' );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment