1. 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?

Discussion in 'XenForo Development Discussions' started by Member 3639, Feb 13, 2011.

  1. Member 3639

    Member 3639 Active Member

    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?
     
  2. Shadab

    Shadab Well-Known Member

    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.
     
  3. Member 3639

    Member 3639 Active Member

    I am talking about outside the forum. Re-read my post mate, nothing to do with the actual XenForo system itself.
     
  4. ragtek

    ragtek Guest

    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. Member 3639

    Member 3639 Active Member

    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.
     
  6. Shadab

    Shadab Well-Known Member

    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.
     
  7. ragtek

    ragtek Guest

    "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. Member 3639

    Member 3639 Active Member

    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.
     
  9. Shadab

    Shadab Well-Known Member

    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.
     
    Member 3639 likes this.
  10. Member 3639

    Member 3639 Active Member

    Interesting thanks for that, will have a play around with that and see how it fairs, where can i find more info on it?
     
  11. Shadab

    Shadab Well-Known Member

    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.
     
  12. Member 3639

    Member 3639 Active Member

    Just tested, works great!
     
  13. Shadab

    Shadab Well-Known Member

    Isn't that vB terminology? :D

    Nice!
     
  14. ragtek

    ragtek Guest

    [ot]
    Oh man, you're right:(
    [/ot]
     
  15. Shadab

    Shadab Well-Known Member

    1 person likes this.

Share This Page