admin管理员组文章数量:1336683
I need to automatically delete the users that are subscribed through a wpforms after 90 minutes of being created.
Users created this way are marked as "invitados" on the profile.
I found this answer on a previous question:
if(!wp_next_scheduled('my_dailyClearOut')) {
wp_schedule_event(time(), 'daily', 'my_dailyClearOut'); }
function my_clearOldUsers() {
global $wpdb;
$query = $wpdb->prepare("DELETE FROM $wpdb->users WHERE datediff(now(), user_registered) > 30");
if ($oldUsers = $wpdb->get_results($query, ARRAY_N)) {
foreach ($oldUsers as $user_id) {
wp_delete_user($user_id[0]);
}
}
}
add_action('my_dailyClearOut', 'my_clearOldUsers');
However, this deletes all types of users including administrator. I only want to delete the type "invitados", I also would like this script to run each 30 minutes and delete all "invitados" that were created 90 minutes ago.
Can anyone help?
本文标签: functionsDeleting guests profile users after 15 hours
版权声明:本文标题:functions - Deleting guests profile users after 1.5 hours 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742268754a2443901.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论