Create not-activated user in code, wordpress

WordPress does not have a active/deactivate function out of the box This worked for me to create users with aditional data. wp_insert_user(array( ‘user_login’ => $username, ‘user_pass’ => $password, ‘user_email’ => $email, ‘wp_user_level’ => $role, ‘show_admin_bar_front’ => ‘false’ //you probably won’t want normal users to see the admin bar )); http://codex.wordpress.org/Function_Reference/wp_insert_user Try adding a temporary role … Read more

How do I list in the backend all users that were assigned to a custom role?

User queries There is a WP_User_Query, analogous to WP_Query for posts: $wp_user_search = new WP_User_Query( array( ‘role’ => ‘editor’ ) ); $editors = $wp_user_search->get_results(); Usually this returns an array of row objects from the user table: echo ‘<ul>’; foreach ($editors as $editor): echo ‘<li>’.$edtior->display_name.'</li>’; endforeach; echo ‘</ul>’; However you can specify it to instead return … Read more

Locate authors on Google map version 3

If you’d like to show actual address as in street name/number you should use reverse geo coding api https://developers.google.com/maps/documentation/geocoding/#ReverseGeocoding basically its something like http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false which you should probably on publish/save post (not on every page load). If you just like to show the markers on the map, I did something similar a couple of years … Read more

Find out who created a certain user?

Hook into the actions user_register, profile_update and delete_user, and inspect the current user. Use get_current_user_id() to get the acting user and use … WP_User::get_data_by( ‘id’, get_current_user_id() ); … to get more data about the user creating or deleting the other user.

Exclude subscriber users from user list

This new method should work. It looks at all the capability values to find “subscriber”, and hides it. Try this query $wpdb->get_results( “SELECT display_name FROM $wpdb->users WHERE 1=1 AND {$wpdb->users}.ID IN ( SELECT {$wpdb->usermeta}.user_id FROM $wpdb->usermeta WHERE {$wpdb->usermeta}.meta_key = ‘{$wpdb->prefix}capabilities’ AND {$wpdb->usermeta}.meta_value NOT LIKE ‘%subscriber%’) ORDER BY display_name ASC” );

Cannot set user passwords

In the fairly recent past, WordPress changed how the password change works. It looks as though you can’t set your own password; but in fact you still can: Click on “Generate Password,” and then, when the automatically generated gobbledygook password comes up, simply edit that field to type in your desired password.