Custom style on profile options page

It works on a standard profile page (your profile / Profile) without other plugins installed. Other plugins may affect the overall result. I think code can be improved, if some one knows how please give it a go. function better_profile_page($buffer) { global $pagenow; if ($pagenow == ‘profile.php’ || $pagenow == ‘users.php’ || $pagenow == ‘user-edit.php’) … Read more

Importing Existing Users with Passwords

You can use wp_insert_user. Since your old database has passwords in base64, you can easily get the original password string using base64_decode. $new_user_data = array( ‘user_pass’ => ‘password’,//pass your decoded password string ‘user_login’ => ‘username’,//pass your username ‘user_email’ => ’email’, ‘first_name’ => ‘firstname’, ‘last_name’ => ‘lastname’, ‘role’ => ‘author’//if you want to specify a different … Read more

Delete user from frontend

Taken directly form the wp_delete_user documentation: if(is_user_logged_in() && !empty($_GET[‘DeleteMyAccount’])) { add_action(‘init’, ‘remove_logged_in_user’); } function remove_logged_in_user() { require_once(ABSPATH.’wp-admin/includes/user.php’ ); $current_user = wp_get_current_user(); wp_delete_user( $current_user->ID ); } Things to note: Your code didn’t check if the user was logged in or not by the time you’re printing the remove user link, the init action has already happened … Read more

Total Word Count For Posts And Comments By One Author

Run a couple of queries and a code snippet to calculate the word count for the post content, comments content and tag names on each post. // This query will return the number of words in the post content $post_qry=”SELECT LENGTH(post_content) – LENGTH(REPLACE(post_content, ‘ ‘, ”))+1 from wp_posts where ID=”.$post_id; // This query will return … Read more

Get users only if Gravatar is specified

Gravatar by design doesn’t require the downstream system to be aware if there is a match. The image (if any) is determined and served on request, only hash needs to be provided. It’s impossible to “guess” from email or its hash if it has an avatar. That can only be resolved by request to the … Read more

Create user with author role but no login information

In a plugin, you can create the users with whatever information you want them to have (First name, last name, etc). The only required user fields are username, email and password, which you can specify. https://codex.wordpress.org/Function_Reference/wp_create_user As Ahmed Mahdi stated above, you can create the users but not send them the login information.

New user notification doesn’t include activation link

WordPress 4.9.0 introduced 2 filters into the new user notification mail function (wp_new_user_notification): wp_new_user_notification_email – to customise the email sent to User wp_new_user_notification_email_admin – to customise the email email sent to Admin We can ignore the second as this is the email sent to the admin the format is different from that in your question. … Read more