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

Adding to the moderation que?

#1
Okay so i allow guests and members to comment/reply on posts from xenforo on my main website, but i wish to have all guest comments go straight to the mod que.

I have implemented the post being added but being invisible, i have implemented adding it to the "xf_moderation_queue" table but it doesn't add it into the mod que on the forum?

I guess i am missing adding to another sql table?
 

Shadab

Well-known member
#2
Admin Panel » Users » Usergroup Permissions » Unregistered / Unconfirmed
Set the "Follow message moderation rules" permission to "Not Set (No)".

Any messages posted by Guests will now be sent to the moderation queue automatically.
 
R

ragtek

Guest
#4
You can set the message state, if you use the datawriter to create the post.

allowed states(defined in the datawriter)
PHP:
	'message_state'          => array('type' => self::TYPE_STRING, 'default' => 'visible',
						'allowedValues' => array('visible', 'moderated', 'deleted')
 
#5
Problem is just setting the post to moderated doesn't put it in the mod que, i create a record in the mod que sql table as well but neither seem to have it show up in the mod que at the top of the forum.
 

Shadab

Well-known member
#6
Use the proper datawriter to create the Post.
It would automatically put the message into moderation queue if needed.

Unless absolutely required to perform a manual SQL query, you should give preference to using a Model and/or a DataWriter to select and manipulate data in core xenforo tables. This maintains compatibility with other components, and makes your code less error prone.
 
R

ragtek

Guest
#7
Problem is just setting the post to moderated doesn't put it in the mod que, i create a record in the mod que sql table as well but neither seem to have it show up in the mod que at the top of the forum.
"You're not allowed" to insert them via an sql query.

AS i said already, if you use the datamanger, he makes everything for you (including the moderation stuff)
PHP:
**
	 * Updates the moderation queue if necessary.
	 */
	protected function _updateModerationQueue()...
Edit: shadab was faster^^
 
#8
Why are you not "allowed" to insert them via a sql query? Remember i am talking about from outside the forum, as in a script on my main website that if someone enters info into a form it creates a reply in XenForo.

Where is the updatemodque function stored?

Saying "AS i said" means nothing when you don't explain what you mean by datamanager or any of that.
 

Shadab

Well-known member
#9
Example:
PHP:
$writer = XenForo_DataWriter::create('XenForo_DataWriter_DiscussionMessage_Post');

$writer->set('user_id', $userId);
$writer->set('username', $username);
$writer->set('message', $message);
$writer->set('message_state', 'moderated');
$writer->set('thread_id', $threadId);

$writer->save();
Maintains full compatibility with other parts of the xenforo system, including but not limited to spam checking, moderation queue updation, any addons that extend the Post datawriter, alerting quoted members, updating the denormalized counters, sending a notification to "watching" users, publishing to news feed, indexing the post contents for search, etc.

So if you choose to bypass the datawriter and insert a post manually, you are in effect breaking all the above listed components.
 

Shadab

Well-known member
#11
You can see how the Thread controller handles insertion of a new post.

XenForo_ControllerPublic_Thread::actionAddReply()
in /library/XenForo/ControllerPublic/Thread.php, line ~475.


PS: When in doubt, simply look at how something is done in a Controller.