Is it possible to duplicate users on a new WordPress install?

Migrate DB Pro can help with this, make sure to migrate any plugin tables and the WP_Users and WP_Usermeta tables if your users make posts and you want that content to remain assigned an available make sure to keep WP_Posts and WP_Postmeta table as well. https://deliciousbrains.com/wp-migrate-db-pro/ Also keep in mind that WP uses an EAV … Read more

Get current user data from external PHP page

You can… Load the file into the file where you want to display the ‘hey username’ message: <?php include(TEMPLATEPATH .’/check-user-hello.php’); ?> . Then in that file “check-user-hello.php” You need to put this code <?php if ( is_user_logged_in() ) { global $current_user; get_currentuserinfo(); echo ‘Hey ‘ . $current_user->display_name; } else { echo ‘<a href=”‘. get_bloginfo(‘url’) .’/wp-admin” … Read more

Drop down list in user profile page

thanks for that. Just one minor tweak, as the first bit of code threw up an error. Below is the working code for the first block of code. //hooks add_action( ‘show_user_profile’, ‘Add_user_fields’ ); add_action( ‘edit_user_profile’, ‘Add_user_fields’ ); function Add_user_fields( $user ) { ?> <h3>Extra fields</h3> <table class=”form-table”> <tr> <th><label for=”text”>text</label></th> <td> <?php // get test … Read more

How to remove Gravatar from Username column

Since there is no special avatar column to unset (the avatars are inside the username column), you could try instead to hide the avatars via css: function hide_avatars_wpse_94126() { if(!current_user_can(‘manage_options’)){ // hide only for non-admins echo “<style>.users td.username img.avatar{display:none !important;}</style>”; } } add_action(‘admin_head-users.php’,’hide_avatars_wpse_94126′); where they are hidden for non-admins. The result will be like this:

set_role has no effect

You can use wp_update_user to update the role for your newly created user. if ( !username_exists( ‘mytestuser’ ) ) { $user_id = wp_create_user(‘mytestuser’, ‘testpass345′,’[email protected]’); $user_id = wp_update_user( array( ‘ID’ => $user_id, ‘role’ => ‘author’ ) ); } Further reading at WordPress Codex. Or, you can remove the current role and assign a new one: if … Read more

the blog owner multisite

I use this workaround to get the ID of the owner of the current blog: $thisblog = $current_blog->blog_id; $mail = get_blog_option($thisblog, ‘admin_email’); $user_from_email = get_user_by(’email’, $mail); $user_id = $user_from_email->ID;

Update user_login to change username

First: The $wpdb object has the names of tables, with prefixes, pre-defined for you. $wpdb->users == ‘wp_users’ $wpdb->posts == ‘wp_posts’ etc. Second: $wpdb-prepare() is essentially a WordPress aware printf, if you pass it more than one argument, you need to have some string/digit replacements %s %d $sql = “UPDATE {$wpdb->users} SET user_login = %s WHERE … Read more

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