How can I delete all entries that belong to a user? It is 100% possible I am going about this the wrong way, so please feel free to correct me.

I have a registration form that creates a user. I have a plugin that is listening to the onSaveUser event:

MyPlugin.php

craft()-&gt;on('users.onSaveUser', function (Event $event) {
    if ($event-&gt;params['isNewUser']) {
        $entry = new EntryModel();
        $entry-&gt;sectionId = 16;
        $entry-&gt;typeId = 1;
        $entry-&gt;enabled = false;
        $entry-&gt;getContent()-&gt;title = craft()-&gt;request-&gt;getPost('firstName') . ' ' . craft()-&gt;request-&gt;getPost('lastName');

        ...

        if (craft()-&gt;entries-&gt;saveEntry($entry)) {
            // success
        } else {
            // trouble!
        }
    }  
});


Everything works great. The entries I am creating are basically an extension of the user's account (height, weight etc). 

I know there are events for deleting a user, but what is the best way to relate the newly created entry so it gets deleted along with the user?

I thought about having an entries field on the actual user account that somehow I populate with the newly created entry?

EDIT

Or, should I have a user field on the newly created entry? In that case, I'm not sure how I populate the newly created entry with the newly created userID.

For example:

...
$user = $event-&gt;params['user'];
$entry = new EntryModel();
$entry-&gt;sectionId = 16;
$entry-&gt;typeId = 1;
$entry-&gt;enabled = false;
$entry-&gt;getContent()-&gt;title = craft()-&gt;request-&gt;getPost('firstName') . ' ' . craft()-&gt;request-&gt;getPost('lastName');

// account is the handle of my users field
$entry-&gt;getContent()-&gt;account = $user-&gt;id;  // im not setting this correctly

if (craft()-&gt;entries-&gt;saveEntry($entry)) {
    // success
} else {
    // trouble!
}

...
You'll want to set the authorId of your entry to be the new user's id.

When you delete that user through the control panel, it'll ask "What do you want to do with this person's content?"... At that point, you can just select "Delete it".