$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>How do I run my custom function in my plugin when a wordpress user is deleted?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

How do I run my custom function in my plugin when a wordpress user is deleted?

matteradmin10PV0评论

I have a custom function in my plugin, I want to run it when any of the wordpress user is deleted so i can know that a user and which user was deleted. I implemented this but it is'nt working.

 function my_delete_user( $user_id ) {
    global $wpdb;
    require_once(ABSPATH.'wp-admin/includes/user.php' );
        $user_obj = get_userdata( $user_id );
        $email = $user_obj->user_email;

    $headers = 'From: ' . get_bloginfo( "name" ) . ' <' . get_bloginfo( "admin_email" ) . '>' . "\r\n";
      wp_mail( $email, 'You are being deleted, brah', 'Your account at ' . get_bloginfo("name") . ' is being deleted right now.', $headers );
}
add_action( 'delete_user', 'my_delete_user' );

but this is not working, as it should send a mail. I want to know which user was deleted from their email.

Post a comment

comment list (0)

  1. No comments so far