Skip to content

Commit

Permalink
hook for user deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
corsacca committed Oct 3, 2018
1 parent cb57f91 commit 9bfc398
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dt-users/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public function __construct() {
add_filter( 'user_row_actions', [ $this, 'dt_edit_user_row_actions' ], 10, 2 );
add_filter( 'manage_users_columns', [ $this, 'new_modify_user_table' ] );
add_filter( 'manage_users_custom_column', [ $this, 'new_modify_user_table_row' ], 10, 3 );
add_action( 'delete_user', [ $this, 'user_deleted' ], 10, 1 );
add_action( 'remove_user_from_blog', [ $this, 'user_deleted' ], 10, 2 );

}

Expand Down Expand Up @@ -608,4 +610,12 @@ public function new_modify_user_table_row( $val, $column_name, $user_id ) {
}
return $val;
}


public function user_deleted( $user_id, $blog_id = null ){
$corresponds_to_contact = self::get_contact_for_user( $user_id );
if ( $corresponds_to_contact ){
delete_post_meta( $corresponds_to_contact, "corresponds_to_user" );
}
}
}

0 comments on commit 9bfc398

Please sign in to comment.