use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
+use Friendica\Database\DBStructure;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Item;
if ($order_field === 'created') {
$params = ['order' => [$order_field]];
- } elseif (!empty($order_field)) {
+ } elseif (!empty($order_field) && DBStructure::existsColumn('photo', [$order_field])) {
$params = ['order' => [$order_field => true]];
} else {
$params = [];