Make user profile field required

What I did create form with fields and validate them: added this line of code to add the user knowledge that it is required fields <span class=”description”><?php _e(‘(required)’); ?></span> added this to form like this: add_action( ‘show_user_profile’, ‘extra_user_profile_fields’ ); add_action( ‘edit_user_profile’, ‘extra_user_profile_fields’ ); function extra_user_profile_fields( $user ) { ?> <table class=”form-table”> <tr> <th><label for=”address”><?php _e(“address”,’shabatkeeper’); … Read more

displaying custom code on a given users profile page

Assuming you are in the back-end (admin), so the user profile page is being rendered by /wp-admin/user-edit.php – there is a global variable that indicates the id of the user whose profile we are on. If you look at the source code for user-edit.php you can see it guarantees (or will die) the existence of … Read more

How to change the link “Edit my profile”?

The filter hook edit_profile_url does that. It returns the URL and provides the User ID so you can use it for some customization of the new URL. add_filter( ‘edit_profile_url’, ‘modify_profile_url_wpse_94075’, 10, 3 ); /** * http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/link-template.php#L2284 * * @param string $scheme The scheme to use. * Default is ‘admin’. ‘http’ or ‘https’ can be passed … Read more

How do I remove the ‘Show Toolbar’ option?

Here’s one way to hide it with CSS: add_action( ‘personal_options’, function( $profileuser ) { ?><style>.show-admin-bar{ display: none;}</style><?php } ); or rather place it within the <head>…</head> with: add_action( ‘admin_print_styles-user-edit.php’, ‘wpse_hide_admin_bar_settings’ ); add_action( ‘admin_print_styles-profile.php’, ‘wpse_hide_admin_bar_settings’ ); function wpse_hide_admin_bar_settings() { ?><style>.show-admin-bar{ display: none;}</style><?php } You could perhaps add your own wpse_hide_admin_bar_settings filter if you need more control: … Read more

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

Replace Gravatar with uploaded images?

If you are set your custom or uploaded profile picture and need to see on front end, you can use below function . <?php echo get_avatar( $id_or_email, $size, $default, $alt, $args ); ?> If you have to change your gravatar to custom profile picture you can refer below link : http://www.wpbeginner.com/wp-tutorials/how-to-change-the-default-gravatar-on-wordpress/

How to change profile picture in wordpress?

Default WordPress uses Gravatar, you can find more information about it here. On WordPress.com, we use Gravatar to associate an avatar with a user’s account. If you’ve set up a Gravatar, it will be displayed when you post to the forums or comment on a blog, and it may also appear if your blog is … Read more

How to disable profile.php for users?

Redirect from profile.php to the dashboard Here’s one way to do it: add_action( ‘load-profile.php’, function() { if( ! current_user_can( ‘manage_options’ ) ) exit( wp_safe_redirect( admin_url() ) ); } ); where we redirect to the dashboard instead, if the current user can’t manage options. Redirect from profile.php to the current user’s member page If you want … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)