Custom capability for a single user

I solved it myself 🙂 I just added custom capability to the user- $user = new WP_User(1); //1 is the admin ID $user->add_cap( ‘see_encrypted_pass’ ); Then checked- if(current_user_can(‘see_encrypted_pass’)){ //encrypted password } It works!!

Import users once a day without a plugin

You can use wp_create_user and pass necessary information like $username, $password, $email , where $email is optional. If user created successfully it will return ID of newly created user, other wise will return error object. Then update user’s other information using update_user_meta.

How to add an attribute to a user?

The easiest trick is to use the user_contactmethods – the fields don’t actually have to be contacts, but WordPress will do all the leg work for you (displaying the fields & saving the data): function wpse_183763_user_contactmethods( $methods, $user ) { $methods[‘my_field_1’] = ‘My Label For Field 1’; $methods[‘my_field_2’] = ‘My Label For Field 2’; return … Read more

User can manage one page accessible by everyone?

As you may or may not be aware WordPress provides a profile page in the admin for each registered user (including the admin of course!): `http://www.example.com/wp-admin/profile.php‘ On that page you will see a number of fields that can be edited / customized including a Biographical Info field. To fetch and output a field from this … Read more

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