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