XF 2.3 This is not a love song!

Robert9

Well-known member
But it could become one!

A few days ago, I found this thread here:

https://xenforo.com/community/threa...hread-if-it-only-contains-their-posts.219590/

And then I thought to myself, okay, let's build this now. But what exactly are we building here?
  1. Permission for soft and hard delete
  2. Check if the thread belongs to the user and if all posts are his
  3. Let him delete the thread
Up to this point, it was no sorcery and even a temp worker like myself somehow managed it.

But being who I am, it continued!

Wouldn't it be good if the user could also see his deleted threads? I spent half a day looking through various files, entities for node, forum, thread, post, but also forum types and thread types. I stuck my nose everywhere, extended classes, and each time found that it didn't work that way or not without additional queries. I was so desperate that I wrote to someone from Xenforo, I'll leave his name out, I don't know if he wants more such questions.

He replied to me later. In the meantime, I came across the ThreadFinder. And that was exactly his tip. ThreadFinder and Entity Thread. Okay, I almost had that too.

I had first adapted the source code of Xenforo itself as I needed it, that was child’s play and only one condition. Done! But then that also had to go into an extension of the class.

And then I sat there for three, four hours, sweating and cursing, and couldn’t get it done. At some point, I realized that I always have to run a class that starts with $conditions = [] first. Then I looked at what my changes to the Xenforo source code do with print_r($conditions). And then finally I found a solution that programmers might not like.

But it works for now.

But being who I am, that's not enough!

Because if the admin deletes something and the user with special rights deletes something, those are two different things! So
  • user can delete their own threads if only their own posts are in them.
  • soft and hard delete
  • user can see their own deleted threads - but only if they deleted them themselves.
  • user can restore their own deleted threads - but only if they deleted them themselves.
And as far as I or you can think of, we would be done and could ask @taydin if he wants to spend two euros for a hard day's work, which we would then donate to the Mütter Genesungswerk.

And now it could become a love song if I post my code here as far as I have it done and discuss it with you.

Is there any interest?
 
Back
Top Bottom