Recent Topics

1 Dec 10, 2008 00:59    

My b2evolution Version: 2.x

I want to delete users but still leave the comments from them. In all honesty i just want comments not to depend on users if they are deleted so that if i delete a user from the database, it won't show an error when a comment that the user made is selected.

It's a weird situation I am in, but I know there is someone out there that knows the answer, I don't, not right now. So if anyone hacked this already please let me know and i will try to do it also. Thanks!

2 Dec 10, 2008 10:34

You can do this manually, but you're probably better slapping it in a plugin in the long run ( just hook into function AfterUserDelete() ).

Basically, when you delete a user, replace the author_ID in comments with null and populate comment_author_name/email/url

¥

3 Dec 10, 2008 23:19

thank you for that, but another question comes to mind after i hear your solution. How can i then find out if any comments left in my system are from users that no longer exist and if they don't exist in the system anymore can i replace those users with null and everything will be ok? Or will i break the system?

4 Dec 11, 2008 10:11

There's probably some fancy sql you can run, but basically you need to compare your current user ID's with comment user id's and update any records that no longer have a current user.

If it was me I'd NULL the user ID, and change the details to "anonymous", "dummy@email.com", "" ( no need for url ) for all the non-existent users

¥

5 Dec 19, 2008 22:49

Last month I deleted 1 user, and after deleting all posts of that user, at the end the deletingprocess told me 'I converted all comments to visitor comments'...
so you don't have to worry, it's build in


Form is loading...