forked from vincentorback/clean-wordpress-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
58 lines (50 loc) · 1.61 KB
/
profile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* Hide Personal Options settings
* @link https://codex.wordpress.org/Plugin_API/Action_Reference/admin_print_scripts
*
* Keyboard Short - .user-comment-shortcuts-wrap
* Admin Color Scheme - .user-admin-color-wrap
* Visual Editor - .user-rich-editing-wrap
* Show Toolbar - .show-admin-bar
*/
add_action( 'admin_print_scripts-profile.php', function () {
?><style>
.user-rich-editing-wrap,
.user-comment-shortcuts-wrap,
.user-admin-color-wrap,
.show-admin-bar {
display: none;
}</style><?php
});
/**
* Remove default user contact fields
* @link https://codex.wordpress.org/Plugin_API/Filter_Reference/user_contactmethods
*
* @param $user_contact Existing contact methods
* @return Array of contact methods
*/
add_filter( 'user_contactmethods', function ( $user_contact ) {
// Remove existing
unset( $user_contact['aim'] );
unset( $user_contact['jabber'] );
unset( $user_contact['yim'] );
return $user_contact;
});
/**
* Removes the "About Yourself / Biographical Info" field.
* @param $buffer Output buffer
*/
function remove_plain_bio( $buffer ) {
$titles = array( '#<h3>' . _x( 'About Yourself' ) . '</h3>#', '#<h3>' . _x( 'About the user' ) . '</h3>#' );
$buffer = preg_replace( $titles, '<h3>' . _x( 'Password' ) . '</h3>', $buffer, 1 );
$biotable = '#<h3>' . _x( 'Password' ) . '</h3>.+?<table.+?/tr>#s';
$buffer = preg_replace( $biotable, '<h3>' . _x( 'Password' ) . '</h3> <table class="form-table">', $buffer, 1 );
return $buffer;
}
add_action( 'admin_head', function () {
ob_start( 'remove_plain_bio' );
});
add_action( 'admin_footer', function () {
ob_end_flush();
});