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

show cimy user fields in users.php with manage_users_columns

A couple thoughts that might help you or others reading this… FWIW, the priority parameter doesn’t have an effect unless you have multiple functions that you’re attaching to the hook. So, 15 or 1 or 9999 is irrelevant. In case you might be thinking the priority has anything to do with column order, it doesn’t. … Read more