jaydrake
Member
Posted 9 months ago #
After a good bit of digging I figured out how to modify the 'edit-user.php' page in the admin area such that it now has the additional information I want for users and no longer shows information that I am not interested in, but I cannot seem to find any way to modify the 'user-new.php' page to match.
In the case of the edit-user.php changes, I was able to add functions that used the add_action( 'show_user_profile', 'value' ) hook to add new items to the page, and a combination of unset() and some jQuery to remove some of the fields.
So far I have not been able to find anything similar that I could use to modify the 'user-new.php' page to achieve similar results. Does anyone know how this can be achieved outside of making changes to the core?
TIA,
Jay
The way I would do this is using jQuery. Add some JS code in the page using 'admin_head-{hook-suffix}' action hook and implement what you need.
jaydrake
Member
Posted 9 months ago #
Is there a hook for that page? I haven't been able to find it. If I simply add/subtract form elements to the page how will WP know to store the added form elements and not concern itself with the elements that were removed?
It this what you need?
// Add Twitter profile field and remove Yahoo IM
function add_twitter_contactmethod( $contactmethods ) {
// Add Twitter
$contactmethods['twitter'] = 'Twitter';
// Remove Yahoo IM
unset($contactmethods['yim']);
return $contactmethods;
}
add_filter('user_contactmethods','add_twitter_contactmethod',10,1);