Lack of interest States in XenForo_Model::prepareStateLimitFromConditions

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

xf_phantom

Well-known member
It would be nice, if you would create a empty function in xenforo_model (prepareStates) and call it inside prepareStateLimitFromConditions

PHP:
public function prepareStateLimitFromConditions(array $fetchOptions, $table = '', $stateField = 'message_state', $userField = 'user_id')
   {
     $fetchOptions = array_merge(
       array(
         'deleted' => false,
         'moderated' => false
       ), $fetchOptions
     );

     $stateRef = ($table ? "$table.$stateField" : $stateField);
     $userRef = ($table ? "$table.$userField" : $userField);

     $states = array("'visible'");
     $moderatedLimit = '';

     if ($fetchOptions['deleted'])
     {
       $states[] = "'deleted'";
     }

     if ($fetchOptions['moderated'])
     {
       if ($fetchOptions['moderated'] === true)
       {
         $states[] = "'moderated'";
       }
       else
       {
         $moderatedLimit = " OR ($stateRef = 'moderated' AND $userRef = " . intval($fetchOptions['moderated']) . ')';
       }
     }
$this->prepareStates($fetchOptions, $states);
     return "$stateRef IN (" . implode(',', $states) . ")$moderatedLimit";
   }

protected function prepareStates($fetchOptions, &$states){

}

OR
anything else, which would allow addon creators, to add own states (if needed) to the returned string


With this addition we could use the method for own elements with more states
 
Upvote 0
This suggestion has been closed. Votes are no longer accepted.
Top Bottom