Commit d5fcaac0 by Cyrille37

hide Yoast SEO #66 edit others projects #68

parent a00225a9
......@@ -52,9 +52,14 @@ class CommunityProject
// defined( 'DOING_AJAX' ) && DOING_AJAX
//add_action( 'admin_menu', array( $this, 'redirect_if_not_author' ) );
add_action( 'init', array( $this, 'disable_wpseo' ) );
add_action( 'admin_menu', array( $this, 'remove_meta_boxes' ) );
add_action( 'do_meta_boxes', array( $this, 'remove_edit_flow_metabox' ) );
//add_action( 'do_meta_boxes', array( $this, 'remove_edit_flow_metabox' ) );
//add_action( 'add_meta_boxes', array( $this, 'remove_edit_flow_metabox' ), 100000 );
add_filter('screen_options_show_screen', array( $this, 'remove_screen_options_tab' ) );
......@@ -62,30 +67,40 @@ class CommunityProject
add_action( 'save_post', array( $this, 'save_custom_meta_box' ), 10, 3 );
add_action( 'wp_dashboard_setup', array( new DashboardWidget(), 'wp_dashboard_setup' ) );
add_filter( 'manage_edit-project_columns', array( $this, 'remove_columns') );
//add_filter( 'wpseo_use_page_analysis', array($this,'wpseo_use_page_analysis') );
//add_filter( 'wpseo_options', array($this,'wpseo_options') );
add_action( 'admin_enqueue_scripts', array( $this, 'wp_admin_enqueue_scripts' ) );
}
new ShortcodeController();
}
/*function wpseo_options( $options )
function disable_wpseo()
{
error_log(__METHOD__);
error_log( print_r($options,true) );
}*/
if( ! UserRoleController::isStudent() )
return ;
add_action( 'wp_print_scripts', array( $this, 'disable_wpseo_dequeue_script'), 10000 );
add_filter( 'manage_edit-project_columns', array( $this, 'disable_wpseo_remove_columns') );
add_action( 'do_meta_boxes', array( $this, 'disable_wpseo_remove_metabox' ) );
/*
if( UserRoleController::isStudent() )
{
// Remove page analysis columns from post lists, also SEO status on post editor
add_filter('wpseo_use_page_analysis', '__return_false');
}*/
}
/*function wpseo_use_page_analysis()
function disable_wpseo_dequeue_script()
{
error_log(__METHOD__);
return false ;
}*/
// To remove javascript error that happen if metabox removed.
// wp-seo-post-scraper-542.min.js?ver=5.4.2:38 Uncaught Error: The snippet preview requires a valid target element
wp_dequeue_script( 'yoast-seo-post-scraper' );
wp_dequeue_script( 'yoast-seo-metabox' );
}
function remove_columns( $columns )
function disable_wpseo_remove_columns( $columns )
{
// remove the Yoast SEO columns
unset( $columns['wpseo-score'] );
......@@ -96,6 +111,11 @@ class CommunityProject
return $columns;
}
function disable_wpseo_remove_metabox()
{
remove_meta_box( 'wpseo_meta','project','normal' );
}
function wp_admin_enqueue_scripts()
{
// remove wp logo submenu
......@@ -180,7 +200,6 @@ class CommunityProject
{
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' );
......
......@@ -49,7 +49,7 @@ class UserRoleController
'Etudiant',
[
//'delete_posts' => false,
//'edit_posts' => false,
'edit_posts' => false,
'edit_projects' => true,
'delete_projects' => true,
......
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