• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 2.0 XF\MVC\Entity\Entity global authority for moderating content?

Marcus

Well-known member
#1
My idea is like a moderator queue with the exception that the content iterator (post_id, conversation_id ...) does not increase.

Chad does lots of annoying things. I want my entity to check if its Chad again, and put Chads contributions in a special table far away from what users can access. I want that entity to not save stuff from Chad, so can I abort in preSave?. For all other users nothing will happen.

Is preSave the best way to check if the content came from Chad and put his stuff in a special table? Is everything (posts, conversations) available at XF\MVC\Entity\Entity at one single variable like $this->data (which includes everything) and can I just json blob Chads in a json table (available at mariadb 12.2)?
 
Last edited:

Mike

XenForo developer
Staff member
#2
You might be best trying to integrate with the spam prevention systems to block this sort of thing. Otherwise, you would need to extend the specific entities that you want to action, as how you would check (the columns in question) and the available actions differ.

Though it seems like the permission system is more likely to be designed to handle this.
 

Marcus

Well-known member
#3
Thanks, I have not thought about spam management, this is really the best way. I see the spam prevention system has full access to the content and can be aborted before even an ID is written out. Also in fact preSave does not autoincrement, but I do not know how to abort nicely.I do want the user to be able to submit content, and permissions would outright remove submit forms.

Code:
// for the record this is how a post reply is handled
$replier->checkForSpam();
$this->assertNotFlooding('post'); // looks nice but doesn't have access to content
$post = $replier->save(); // at presave() it also does not autoincrement the ID which is helpful! Directly at \Entity it's a bit too abstract.