ID);
$current_userid=$current_user->ID;
$current_user_roles=$user_info->roles;
$get_config=$wpdb->get_results("SELECT option_name,option_value FROM {$wpdb->prefix}atb_options;",OBJECT);
if($get_config):
foreach($get_config as $row):
if($row->option_name=='disable_visual_editor') $disable_visual_editor=$row->option_value;
if($row->option_name=='disable_visual_editor_role') $disable_visual_editor_role=explode(",",$row->option_value);
if($row->option_name=='disable_visual_editor_role_exclude') $disable_visual_editor_role_exclude=$row->option_value;
if($row->option_name=='disable_visual_editor_post') $disable_visual_editor_post=explode(",",$row->option_value);
if($row->option_name=='disable_visual_editor_post_exclude') $disable_visual_editor_post_exclude=$row->option_value;
if($row->option_name=='disable_heartbeat') $disable_heartbeat=$row->option_value;
if($row->option_name=='disable_heartbeat_pagetype') $disable_heartbeat_pagetype=explode(",",$row->option_value);
if($row->option_name=='disable_heartbeat_pagetype_exclude') $disable_heartbeat_pagetype_exclude=$row->option_value;
if($row->option_name=='disable_heartbeat_post') $disable_heartbeat_post=explode(",",$row->option_value);
if($row->option_name=='disable_heartbeat_post_exclude') $disable_heartbeat_post_exclude=$row->option_value;
if($row->option_name=='limit_revisions') $limit_revisions=$row->option_value;
if($row->option_name=='limit_revisions_count') $limit_revisions_count=$row->option_value;
if($row->option_name=='limit_revisions_post') $limit_revisions_post=explode(",",$row->option_value);
if($row->option_name=='limit_revisions_post_exclude') $limit_revisions_post_exclude=$row->option_value;
if($row->option_name=='limit_usereditor_role') $limit_usereditor_role=$row->option_value;
if($row->option_name=='limit_usereditor_role_role') $limit_usereditor_role_role=explode(",",$row->option_value);
if($row->option_name=='limit_usereditor_role_role_exclude') $limit_usereditor_role_role_exclude=$row->option_value;
if($row->option_name=='limit_usereditor_hiderole_role') $limit_usereditor_hiderole_role=$row->option_value;
if($row->option_name=='password_reset_link') $password_reset_link=$row->option_value;
if($row->option_name=='password_reset_link_role') $password_reset_link_role=explode(",",$row->option_value);
if($row->option_name=='password_reset_link_role_exclude') $password_reset_link_role_exclude=$row->option_value;
if($row->option_name=='disabled_notices') $disable_notices=$row->option_value;
if($row->option_name=='disabled_notices_role') $disable_notices_role=explode(",",$row->option_value);
if($row->option_name=='password_reset_link_role_exclude') $disable_notices_role_exclude=$row->option_value;
endforeach;
else: add_action('admin_notices','atb_admin_notice');
endif;
// Disable TinyMCE Visual Editor
if(strpos($_SERVER['REQUEST_URI'],'wp-admin/post.php?post=')!==false && $disable_visual_editor==1) {
if(($disable_visual_editor_role_exclude==0 && (count(array_intersect($disable_visual_editor_role,$current_user_roles))>0 || in_array('*All',$disable_visual_editor_role,true)))
|| ($disable_visual_editor_role_exclude==1 && (count(array_intersect($disable_visual_editor_role,$current_user_roles))==0 || in_array('*All',$disable_visual_editor_role,true)))) {
$post=get_post(intval($_GET['post']));
$post_type=$post->post_type;
if(empty($post_type)) $post_type=sanitize_text_field($_GET['post_type']);
if(($disable_visual_editor_post_exclude==0 && (in_array($post_type,$disable_visual_editor_post,true) || in_array('*All',$disable_visual_editor_post,true)))
|| ($disable_visual_editor_post_exclude==1 && (!in_array($post_type,$disable_visual_editor_post,true) || in_array('*All',$disable_visual_editor_post,true)))) {
add_filter('user_can_richedit','__return_false');
}
}
}
// User New/Edit Screen
if((strpos($_SERVER['REQUEST_URI'],'wp-admin/user-new.php')!==false || strpos($_SERVER['REQUEST_URI'],'wp-admin/user-edit.php')!==false) && $limit_usereditor_role==1) {
if(($limit_usereditor_role_role_exclude==0 && (count(array_intersect($limit_usereditor_role_role,$current_user_roles))>0 || in_array('*All',$limit_usereditor_role_role,true)))
|| ($limit_usereditor_role_role_exclude==1 && (count(array_intersect($limit_usereditor_role_role,$current_user_roles))==0 || in_array('*All',$limit_usereditor_role_role,true)))) {?>
}
}
// Password Reset via Emailed Link
if($password_reset_link==1) {
if(($password_reset_link_role_exclude==0 && (count(array_intersect($password_reset_link_role,$current_user_roles))>0 || in_array('*All',$password_reset_link_role,true)))
|| ($password_reset_link_role_exclude==1 && (count(array_intersect($password_reset_link_role,$current_user_roles))==0 || in_array('*All',$password_reset_link_role,true)))) {
if(strpos($_SERVER['REQUEST_URI'],'wp-admin/user-edit.php')!==false) { ?>
}
}
}
// Disable Update Notices
if($disable_notices==1) {
if(($disable_notices_role_exclude==0 && (count(array_intersect($disable_notices_role,$current_user_roles))>0 || in_array('*All',$disable_notices_role,true)))
|| ($disable_notices_role_exclude==1 && (count(array_intersect($disable_notices_role,$current_user_roles))==0 || in_array('*All',$disable_notices_role,true)))) {
add_action('admin_notices', 'no_update_notification', 1);
//echo "";
}
}
// Stop WordPress Heartbeat on public pages
if($disable_heartbeat==1) {
if(($disable_heartbeat_pagetype_exclude==0 && (in_array('Admin',$disable_heartbeat_pagetype,true) || in_array('*All',$disable_heartbeat_pagetype,true)))
|| ($disable_heartbeat_pagetype_exclude==1 && (!in_array('Admin',$disable_heartbeat_pagetype,true) || !in_array('*All',$disable_heartbeat_pagetype,true)))) {
$post=get_post(intval($_GET['post']));
$post_type=$post->post_type;
if(empty($post_type)) $post_type=sanitize_text_field($_GET['post_type']);
if(($disable_heartbeat_post_exclude==0 && (in_array($post_type,$disable_heartbeat_post,true) || in_array('*All',$disable_heartbeat_post,true)))
|| ($disable_heartbeat_post_exclude==1 && (!in_array($post_type,$disable_heartbeat_post,true) || in_array('*All',$disable_heartbeat_post,true)))) {
add_action('init','stop_heartbeat',1);
function atb_stop_heartbeat() {wp_deregister_script('heartbeat');}
//echo "";
}
}
}
// Limit Post Revisions
if(strpos($_SERVER['REQUEST_URI'],'wp-admin/post.php?post=')!==false && $limit_revisions==1) {
$post=get_post(intval($_GET['post']));
$post_type=$post->post_type;
if(empty($post_type)) $post_type=sanitize_text_field($_GET['post_type']);
if(($limit_revisions_post_exclude==0 && (in_array($post_type,$limit_revisions_post,true) || in_array('*All',$limit_revisions_post,true)))
|| ($limit_revisions_post_exclude==1 && (!in_array($post_type,$limit_revisions_post,true) || in_array('*All',$limit_revisions_post,true)))) {
//echo "";
function atb_post_revisions($limit_revisions_count) {return $limit_revisions;}
add_filter('wp_revisions_to_keep','atb_post_revisions',10,2);
}
}