Even though WordPress might not the friendliest CMS for user management, provides a good amount of customization for users meta information and profiles. However, one thing that is a bit rough right now is the Personal Options block in the User Pofile: you can’t hide it by removing an action hook or even filter it. In this tutorial we’re going to learn how to removing it using jQuery.
You would assume that WordPress would have a hook to remove an action that generated the user profile and its different sections, but that’s it not the case. A filter? no. A specific class at least? don’t count on it. There’s a hook to dismiss the Color Scheme module but that’s it. For the other stuff we’re going to use jQuery. Open your theme’s functions.php file and add the following
if ( is_admin() ) {
remove_action("admin_color_scheme_picker", "admin_color_scheme_picker");
add_action( 'personal_options', 'ozh_personal_options');
}
The first action we’re adding will prevent WordPress from outputting the Color Scheme section. We could have just let it be displayed since we’re going to strip it out anyway with, but let’s better save a couple of nanoseconds. In any case, if you only want to hide the Color Scheme block this action and its corresponding function is all you need. So long Color Scheme! this is what you should have by now:
The second action will add a bit of JavaScript to the section. This trick is borrowed from Ozh, who wrote a post about adding options to the Personal Options section using this hook. Now we need the function to be executed.
function ozh_personal_options() {
?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#your-profile .form-table:first, #your-profile h3:first").remove();
});
</script>
<?php
}
And that’s it, your Personal Options section is now gone!
This might come handy for membership sites where your users are not going to post anything and will seldom be in the back end. Why offer them a bunch of confusing options? Let’s keep it simple and remove those options that are useless for your subscribers.
Hopefully, using the first selector in jQuery won’t be neccesary for too long, since there’s a ticket in WordPress Trac scheduled for WP 3.1 to add specific classes to user profile. Now if we could only have core support for taxonomies for users…