Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User delete workflow fixes for #1365 #1404

Merged
merged 5 commits into from
Jul 30, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
adds a function on the 'delete_user' hook to delete the 'correspons_t…
…o_user' meta key and value.
  • Loading branch information
micahmills committed May 31, 2021
commit 8afdc7a1a020f5bcb3cbe26f03353b314099ee21
13 changes: 13 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,3 +485,16 @@ function dt_theme_admin_notice_required_php_version() {
</div>
<?php
}

add_action( 'delete_user', 'dt_delete_user_contact_meta' );
function dt_delete_user_contact_meta( $user_id ) {
global $wpdb;
// phpcs:disable
// WordPress.WP.PreparedSQL.NotPrepared
$wpdb->get_results( "DELETE FROM $wpdb->postmeta pm
corsacca marked this conversation as resolved.
Show resolved Hide resolved
WHERE meta_key = 'corresponds_to_user'
AND pm.meta_value = $user_id
");
// phpcs:enable

}