List total number of users that are authors

count_users() should give you an array of all the required user counts. You can use it like this. $user_counts = count_users(); $authors = $user_counts[‘avail_roles’][‘author’]; //Get the author count $subscribers = $user_counts[‘avail_roles’][‘subscriber’]; //Get the subscriber count echo $authors. ‘ Authors so far’; echo $subscribers. ‘ Subscribers so far’;

Show User Their Password

Theoretically, this could be achieved by saving a user’s password elsewhere, when he or she updates it. Note that this sort of thing is hardly ever recommendable. In almost all cases, there is a better architectural approach that renders having to be able to show plain-text passwords unnecessary. That being said, if you absolutely must … Read more

Order users by custom user meta

Here’s the solution. Comments included: <?php $results = get_users(‘role=director’); foreach ($results as $result) { // Get data about each user as an object $user = get_userdata($result->ID); // Create a flat array with only the fields we need $directors[$user->ID] = array( ‘dir_order’ => $user->exit_director_order, ‘dir_id’ => $user->ID, ‘dir_name’ => $user->first_name.’ ‘.$user->last_name ); } // Sort sort($directors); … Read more

Add a custom column in users list page

One thing you should remember is that function, which will be hooked into manage_users_custom_column action must have 3 parameters, the first of which (i.e. $val) should be the returned value: // Add custom column using ‘manage_users_columns’ filter if(!function_exists(‘bm_utm_column’)){ function bm_utm_column($columns) { return array_merge( $columns, array(‘utm_source’ => __(‘UTM source’), ‘utm_medium’ => __(‘UTM medium’) ) ); } … Read more

determining if the user is logged in

Use the is_user_logged_in() conditional tag (Codex ref) to determine if the current user is logged in. Use the get_userdata() function (Codex ref) to return user data.

Querying Email Addresses for a List of Users with Same Last Name?

Hi @Holidaymaine: Here’s the query you are looking for: <?php include( ‘../wp-load.php’ ); $sql =<<<SQL SELECT DISTINCT u.user_email AS user_email, um.meta_value AS user_lastname FROM {$wpdb->users} AS u LEFT JOIN {$wpdb->usermeta} AS um ON u.ID = um.user_id LEFT JOIN {$wpdb->posts} AS p ON u.ID = p.post_author LEFT JOIN {$wpdb->term_relationships} AS tr ON p.ID = tr.object_id LEFT … Read more

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