XF 2.2 Find posts by max characters length?

Earl

Well-known member
Is there a way to find posts by max characters?
I wanna do something like in this query
SELECT * FROM xf_posts WHERE CHAR_LENGTH(message)<10;

with $finder, something like
PHP:
public function isCharacterLengthLongerThan($max = 10)
{
    $this->where(CHAR_LENGTH(message), '<', $max);
    return $this;
}
PHP:
$finder = \XF::finder('XF:Posts');
$users = $finder->isCharacterLengthLongerThan(15)->order('post_date', 'DESC')->limit(10);

o0_.svg


is this possible? anyone wanna share any example code with custom finder method?

And, will it work on posts that contained unicodes?
 
Last edited:
  • Like
Reactions: Max
Top Bottom