有一些钩子可以删除配置文件页面的某些部分。此外,您可以使用php缓冲页面输出,然后剥离相关内容。
// Remove fields from Admin profile page
if (!function_exists(\'CCK_remove_profile_options\')) {
function CCK_remove_profile_options($subject)
{
$subject = preg_replace(\'#<h2>\' . __("Personal Options") . \'</h2>#s\', \'\', $subject, 1); // Remove the "Personal Options" title
$subject = preg_replace(\'#<tr class="user-syntax-highlighting-wrap(.*?)</tr>#s\', \'\', $subject, 1); // Remove the "Syntax Highlighting" field
$subject = preg_replace(\'#<tr class="user-rich-editing-wrap(.*?)</tr>#s\', \'\', $subject, 1); // Remove the "Visual Editor" field
$subject = preg_replace(\'#<tr class="user-comment-shortcuts-wrap(.*?)</tr>#s\', \'\', $subject, 1); // Remove the "Keyboard Shortcuts" field
$subject = preg_replace(\'#<tr class="show-admin-bar(.*?)</tr>#s\', \'\', $subject, 1); // Remove the "Toolbar" field
//$subject = preg_replace(\'#<h2>\'.__("Name").\'</h2>#s\', \'\', $subject, 1); // Remove the "Name" title
//$subject = preg_replace(\'#<tr class="user-display-name-wrap(.*?)</tr>#s\', \'\', $subject, 1); // Remove the "Display name publicly as" field
$subject = preg_replace(\'#<h2>\' . __("Contact Info") . \'</h2>#s\', \'<h2>\' . __("Login Management") . \'</h2>\', $subject, 1); // Remove the "Contact Info" title
$subject = preg_replace(\'#<tr class="user-url-wrap(.*?)</tr>#s\', \'\', $subject, 1); // Remove the "Website" field
$subject = preg_replace(\'#<tr class="user-googleplus-wrap(.*?)</tr>#s\', \'\', $subject, 1); // Remove the "Google+" field
$subject = preg_replace(\'#<tr class="user-twitter-wrap(.*?)</tr>#s\', \'\', $subject, 1); // Remove the "Website" field
$subject = preg_replace(\'#<tr class="user-facebook-wrap(.*?)</tr>#s\', \'\', $subject, 1); // Remove the "Website" field
$subject = preg_replace(\'#<h2>\' . __("Account Management") . \'</h2>#s\', \'\', $subject, 1); // Remove the "About Yourself" title
$subject = preg_replace(\'#<h2>\' . __("About Yourself") . \'</h2>#s\', \'\', $subject, 1); // Remove the "About Yourself" title
$subject = preg_replace(\'#<h2>\' . __("About the user") . \'</h2>#s\', \'\', $subject, 1); // Remove the "About Yourself" title
$subject = preg_replace(\'#<tr class="user-description-wrap(.*?)</tr>#s\', \'\', $subject, 1); // Remove the "Biographical Info" field
//$subject = preg_replace(\'#<tr class="user-profile-picture(.*?)</tr>#s\', \'\', $subject, 1); // Remove the "Profile Picture" field
//$subject = preg_replace(\'#<h3>\' . __("User Expiry Information") . \'</h3>#s\', \'\', $subject, 1); // Remove the "Expire Users Data" title
return $subject;
}
function CCK_profile_subject_start()
{
//if ( /*!*/ current_user_can(\'manage_options\') ) {
ob_start(\'CCK_remove_profile_options\');
//}
}
function CCK_profile_subject_end()
{
//if ( /*!*/ current_user_can(\'manage_options\') ) {
ob_end_flush();
//}
}
}
add_action(\'admin_head\', \'CCK_profile_subject_start\');
add_action(\'admin_footer\', \'CCK_profile_subject_end\');
// Removes ability to change Theme color for the users
remove_action(\'admin_color_scheme_picker\', \'admin_color_scheme_picker\');