How do you make the email field on the profile page read only for subscribers?

Although the readonly attribute can be removed using Chrome/Firebug inspector (making the field editable again), much probably the average user will not know this. <?php function wpse50730_script_enqueuer(){ if(current_user_can(‘subscriber’)) { echo ‘<script type=”text/javascript”> jQuery(document).ready( function($) { $(“.form-table #email”).attr(“readonly”, true); }); </script>’; } } add_action(‘admin_head-profile.php’, ‘wpse50730_script_enqueuer’);

How to create a edit profile page for users?

This is a pretty big thing to ask but basically you go: Add extra user fields using the code from this answer: Extra User Fields Change them with a custom template for the user: /* Get user info. */ global $current_user, $wp_roles; get_currentuserinfo(); Now you have the logged in user data which you can then … Read more

Forcing nickname as display_name in custom edit profile template

I’m not 100% sure if I follow the logic of your question. But this is probably what you need: if ( !empty( $_POST[‘nickname’] ) ) { wp_update_user( array (‘ID’ => $current_user->id, ‘display_name’ => esc_attr( $_POST[‘nickname’] ) ) ) ; update_user_meta($current_user->id, ‘nickname’, esc_attr( $_POST[‘nickname’] ) ); update_user_meta($current_user->id, ‘display_name’, esc_attr( $_POST[‘nickname’] ) ); } Attention: update_usermeta has … Read more

How to change admin bar color scheme in MP6 / WP 3.8 front end?

At the moment (3.8) color schemes do not apply to admin bar at front end at all, even if user is logged in and has non-default scheme selected. The shortest way would probably be to force enqueue color scheme at front end: add_action( ‘wp_enqueue_scripts’, function () { wp_enqueue_style( ‘color-admin-bar’, admin_url( ‘/css/colors/coffee/colors.min.css’ ), array( ‘admin-bar’ ) … Read more

Remove WordPress Toolbar buttons

function mytheme_admin_bar_render() { global $wp_admin_bar; $wp_admin_bar->remove_menu(‘wp-logo’); } add_action( ‘wp_before_admin_bar_render’, ‘mytheme_admin_bar_render’ ); For specific user roles you can wrap the add_action in a conditional, something like if(current_user_can(‘editor’)){ add_action( ‘wp_before_admin_bar_render’, ‘mytheme_admin_bar_render’ ); } http://codex.wordpress.org/Roles_and_Capabilities

How to add first name & last name to default registration form?

Add this code in functions.php add_action( ‘register_form’, ‘myplugin_register_form’ ); function myplugin_register_form() { $first_name = ( ! empty( $_POST[‘first_name’] ) ) ? trim( $_POST[‘first_name’] ) : ”; $last_name = ( ! empty( $_POST[‘last_name’] ) ) ? trim( $_POST[‘last_name’] ) : ”; ?> <p> <label for=”first_name”><?php _e( ‘First Name’, ‘mydomain’ ) ?><br /> <input type=”text” name=”first_name” id=”first_name” … Read more

Extra profile field as select box?

Place the following code in your functions.php <?php add_action( ‘show_user_profile’, ‘show_extra_profile_fields’ ); add_action( ‘edit_user_profile’, ‘show_extra_profile_fields’ ); function show_extra_profile_fields( $user ) { ?> <h3>Extra profile information</h3> <table class=”form-table”> <tr> <th><label for=”gender”>Gender</label></th> <td> <select name=”gender” id=”gender” > <option value=”Male” <?php selected( ‘Male’, get_the_author_meta( ‘gender’, $user->ID ) ); ?>>Male</option> <option value=”Female” <?php selected( ‘Female’, get_the_author_meta( ‘gender’, $user->ID ) … Read more