How to disable users changing their display_name?

You can use jQuery to disable the display name select. function disable_display_name() { global $pagenow; if ( $pagenow == ‘profile.php’ ) { ?> <script> jQuery( document ).ready(function() { jQuery(‘#display_name’).prop(‘disabled’, ‘disabled’); }); </script> <?php } } add_action( ‘admin_head’, ‘disable_display_name’, 15 );

Get the author registration date in the header.php file

If you are using this on author pages or in loop then you can simply use this. echo the_author_meta( ‘user_registered’ ); This will output registration date of author. So your function will become. if ( is_author() ) { $curauth = ( isset($_GET[‘author_name’]) ) ? get_user_by( ‘slug’, $author_name ) : get_userdata( intval($author) ); $date = the_author_meta( … Read more

How to get only 1 role from user

Try this: if ( !empty( $user->roles ) && is_array( $user->roles ) ) { $first_role = array_shift($user->roles); echo $first_role; } Function array_shift obtains the first element of the $user->roles array.

Not able to call value in the core files

You’r following an bad idea. What you would like to reallize is, displaying a few profiles, not all. It doesn’t matter if the role is named “king” or “queen” even if your specific roles called so. There is an better way to reallize such Kind of requirements: Capabilities. Add an capabilitie to WordPress and just … Read more

How To Find The ID Of All Registered Users?

WP_User_Query has an ‘exclude’ argument, which is designed to accept an array of user IDs to exclude. Since it will accept an empty array, when that’s the only parameter, the resulting object will contain all registered users. The most direct path to the IDs is via the $results property. We can reduce $results to just … Read more

Manage user profiles with WordPress

As you are going to enter all data by yourself you can make use of Custom Post Types. Create 3 CPTs for each user type, Trustee, Alumni, Scholar. And with that create custom fields as per your need for each CPT. Once all data is in, then you need is to create Custom Page templates … Read more

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