What’s the difference between the capability remove_users and delete_users?

The difference is really no difference in regular (single install) WordPress. It’s in a multisite install (network) where there is a difference. In multisite, only a Super Admin (who can manage everything on the network) has delete_users capability, while an “admin” (who would own/manage a single site) can remove_users from their site, but cannot delete … Read more

List users by last name in WP_User_Query

There is a better way to do this as of WordPress version 3.7. Use the WordPress property meta_key to select the last name property and then orderby => meta_value with an ascending order. <?php $args = array( ‘meta_key’ => ‘last_name’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’ ); $user_query = new WP_User_Query( $args ); if ( … Read more

Is there a way to merge two users?

Generally speaking I agree with most of the other answers but, if for some reason you really had to merge two accounts here is how that could work. Merging User-B into User-A Reassign all of User-B’s content to User-A Determine the highest privilege of User-B If higher than the privileges of User-A elevate User-A’s privileges … Read more

How to get userid at wp_logout action hook?

How about hooking ‘clear_auth_cookie’ with the cleaning you need to do? If you need even more depth, you can outright replace wp_clear_auth_cookie(), but that can get into issues where it will conflict with other plugins, so avoid that if possible.

get_current_user_id() returns 0?

Going by wp_get_current_user() information in the Codex, the function utilizes the global $current_user object and if necessary initializes it before use. As others have stated, get_current_user_id() uses this function on the backend. Consider /wp-includes/user.php, lines 323-327 (the function definition for this code). At the tail end, the return value is return ( isset( $user->ID ) … Read more

How to Merge Two Authors Into One?

Yes, this is a good question and the answer is basic WordPress 101 (core), contrary to the two comments above. No plugin necessary. You simply go to Users and delete the author (user) that you don’t want to keep. WordPress then asks you if you want to delete their content or attribute it to another … Read more

Confirmation required on email change

Like SickHippie posted this functionality is native to WordPress but only for a multisite setup so here is the two functions you need to get this to work on a single site setup which are mostly code one for one from the core /wp-admin/user-edit.php file function custom_send_confirmation_on_profile_email() { global $errors, $wpdb; $current_user = wp_get_current_user(); if … Read more

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