Delete User History

I would like to be able to delete the history of a user. The use case here is that I have a shared account that multiple people use. In this case, it is for people who stay with me for a short period and then move on. It would be nice if I could hit a button and set everything back to a default account periodically.

That is what the “Guest” managed user account is for.
When it is disabled, it will forget all its history.

1 Like

The guest account is a good solution if you know beforehand that the user would likely
be temporary. However, it does not apply to cases like a divorce or the death.
In my experience, even if you delete a user in your Home, that user’s history
remains in the database. I also would like to be able to “fully and completely
delete” all traces of a user.

Hmm, Good Point. In my case, guest access is not an ideal solution either. I have multiple accounts with differing restrictions people can use. Children, Teens, Adults, etc.

It appears as though the Guest Account can only occupy one of those spots. Perhaps a better solution for a situation like this would be a button that says delete user history. That would work in both of our use cases. If you want to delete all data, you just click the button before deleting the user.

And I agree with you. For privacy sake, when people delete a user, they expect that the data is gone. Even if the only way of deleting the data was to delete the account. In that case, I could simply delete the user account periodically and then re-add the account. That would be a solution.

Although, just because I want to remove a user from accessing my library, does not mean I want to stop seeing the watching stats & clearing a user’s history does not mean I want to cease to have access to the history.

In my case, I was hoping to retain all the watching data. Just that in their interface, it looks clean. So it appears there might be different expectations of what is deleted.

If you delete this user and create a new one, exactly this should happen. Even if you use the same name.

1 Like

There are a number of solutions that fit your needs.

  • Delete a user & recreate it
  • Use a Safe EMail program to invite Home Users & delete them when you are done with them. (My personal preference)
  • Create Managed User profiles for different restriction levels & delete & re-add them each time.

Deleting a user and re-adding the same user (same name) in your “home” does not
delete the history. In fact, you will end up with different histories for 2 different
users both of which have the same name.

And that is exactly the behavior which the OP was asking for above.

1 Like

The request is to have the play history reset, deleting the user & recreating them gives that. Like I said, my personal preference is to use Abine Blur to create safe EMails. All messages go to the same account. I use it to register for things online because if I start getting spam I know where it came from because each email gets used once. I have 2 plex accounts set up as home users & 1 as a friend. If I need to login somewhere I can & not compromise my security. I would personally create a new account each time with a different Email (Rnd0mstr1g@opayq.com) & set whatever custom restrictions. When it’s done trash it & create a new one

I don’t know why you’d want to so permanently scrub all traces of a person who died. As for a divorce just delete your server & recreate it if you need to be that petty

I don’t have remote access enabled, all my users are in my Home (family).
Temporary email addresses don’t matter to me.

I don’t think it would necessarily be petty to want to remove an ex-s history
totally and completely. Just as ex-s usually remove wedding photos
of spouse #1 from the mantel, it seems to me that some spouse #2’s (if he or she
is technically inclined) would not need to be needlessly reminded of spouse #1’s
name and viewing history. Having to remove and reinstall PMS to accomplish that
seems like overkill to me, and wouldn’t it also delete the history/status of
all your other users?

All that would be accomplished by removing the user, you don’t need to remove all traces from history. That’s why it is petty.

You don’t need remote access for it to be useful. I use temporary email address for local login. It creates a different password used to login to the same family Home account. With access to the same users if you add them to the home. All going to the same actual EMail address, so ideal if created by the same person. You don’t have to have remote streaming on to add a home user by email

@LostOnTheLine

We have drifted away from the request. The request to to have an option to delete old user data for whatever the personal reason is for the deletion.

I have seen options for work arounds but that is not what this is requesting. I personally would like to have the option for this as I like to remove old data and keep my systems clean (OCD and security issues). But again the reason is irrelevant as this is a suggested feature.

If you agree please vote.

1 Like

Agree. It seems like a 101 feature of user management…

The problem is that Plex wants your history, so they don’t want you to delete it. They use your watch history for commercial purposes. The project is drifting from a home server to becoming a streaming network.

Pure conjecture, not fact.
No, for personal media (i.e. anything on your or other Plex user’s servers) they don’t.

It is conjecture. I admit that.

It’s conjecture based on the common sense deduction that developers have chosen to not allow a user to reset their database in any way. No deleting a user or watch history… No “reset the database” altogether. No deleting specific entries. Nothing. Every single interaction with the server is recorded indefinitely, and the server owner cannot easily remove anything without hacking or performing a fresh install.

My sarcasm wants me to point out that it must be immensely difficult to incorporate a trash can icon next to an item, that removes an entry from the database on the backend. It’s not, of course. So that begs the question, why? Enter my conjecture.

This watch history wouldn’t need to be shared with Plex to have your own server recommend “paid” or “premium” content which Plex offers if you’re willing to subscribe. And history is always one privacy policy update away from becoming shared.

If the developers intentionally attempt to keep us from deleting it… common sense tells me they want it there for a reason. The project moving more toward a streaming service makes me skeptical as to why.

Not trying to be rude. Just trying to make sense as to why this is an unanswered feature request for so long. I shouldn’t need to reinstall my server to get rid of history for users which I no longer have.

I would like re-voice the desire to be able to delete watch history. Regardless of the scenarios described above, those are specific use cases, there are other cases where just being able to wipe away the history of a previous user would be desired. There could be personal reason you do not wish to see a certain user name continually in watch history, hours viewed or whatever. I would love to be able to select a user that has been removed and wipe our their history.

I’ll post this here in case its of use to anyone.

User View History which is shown in the dashboard is stored within one table of the plex db. This table is called metadata_item_views. If as an example you wanted to delete all the played history of a specific user you could do following…

First: Find the account id for the user. The account id is stored in the accounts table and you can find the id by running the following:

"/usr/lib/plexmediaserver/Plex Media Server" --sqlite com.plexapp.plugins.library.db
.mode column
select id, name from accounts;
.quit

You will see something like the following with the accounts on your server …

sqlite> select id, name from accounts;
id        name        
--------  ------------
0                     
123456    Account123456   
1         xxxxxxx
sqlite>

Second: As we know the account number we can then delete all played history for that account using the following …

"/usr/lib/plexmediaserver/Plex Media Server" --sqlite com.plexapp.plugins.library.db
DELETE from metadata_item_views WHERE account_id = 123456;
.quit

Backup is your friend here so make sure you take backups especially if your not familiar with sql. Also, I’d recommend if your are doing this to ensure plex is stopped, just good practice when doing direct database edits.

BTW… watched status is stored in metadata_item_settings so if you ever want to the same for status then the same process will work on that table.

2 Likes

Thanks for that, it’s very helpful.

Because you have that information maybe you can answer the question that has been raised here.

If a user is deleted does their watch history remain in the database?

The issue has been raised & I believe it does not because if you create a new user with the same name the watch history resets. But the possibility of it creating a 2nd User ID with the same name is definitely a possibility but seems unlikely because that is just database bloat with no benefits. But I’m not personally going to dig into it verify. But as someone who is already familiar with it I figure you might have an answer.
Also, would this same method work for users who are not currently able to login?

Based on previously experience of removing a user I would say most certainly, YES, stuff will remain. Maybe things have changed since I done it but I’d say that is unlikely. Anything they viewed, watched, updated status on will all still remain in the DB. However, as you removed them they don’t have access to anything. Just their data remains, I guess for statistical purposes.

Myself and @Volts messaged about manual cleanup of a db when removing a user. I had come up with my own list of tables containing the account_id field and his list matched mine.

So as much as I can be sure this should be a full list of all the tables which contain account_id which is used to store information on accounts.

library_section_permissions
media_item_settings
media_part_settings
media_stream_settings
metadata_item_accounts
metadata_item_settings
metadata_item_views
play_queues
plugin_permissions
statistics_bandwidth
statistics_media
view_settings

If you run DELETE from <tablename> WHERE account_id = <id you want to delete>; it should in theory purge all references in your db of the user by id you want to remove.

As I said above, backup is your friend here when doing anything like this. If you go down this road do some testing of your server after the change, ensure your watched status, view history, stats in dashboard are all what you would expect. But if done right you should be okay.

2 Likes