I noticed that arrowchat does not allow to sort rooms by a custom numeric field.
I then went ahead and decided to implement this. You could use it for your specific case or for future implementations:
1. Add the `ord` field on arrowchat_chatroom_rooms
ALTER TABLE arrowchat_chatroom_rooms ADD `ord` tinyint(1) unsigned default 0;
2. modify arrowchat/includes/json/receive/receive_chatroom_list.php:
- locate the query that pulls the rooms list:
SELECT id, name, description, image, type, length, session_time, is_featured
FROM arrowchat_chatroom_rooms
- add the ord field to the query to read like:
SELECT id, name, description, image, type, length, session_time, is_featured, ord
FROM arrowchat_chatroom_rooms
- locate the following line (around line 130):
$chatrooms[] = array('id' => $chatroom['id'], 'n' => $chatroom['name'], 'd' => $chatroom['description'], 'img' => $chatroom['image'], 't' => $chatroom['type'], 'c' => $count['COUNT(user_id)'], 'o' =>
other_chatroom);
- append the ord field as follows:
$chatrooms[] = array('id' => $chatroom['id'], 'n' => $chatroom['name'], 'd' => $chatroom['description'], 'img' => $chatroom['image'], 't' => $chatroom['type'], 'c' => $count['COUNT(user_id)'], 'o' => $other_chatroom, 'ord' => $chatroom['ord']);
- locate the following line by the end of the file:
$response['chatrooms'] = $chatrooms;
- write this line right before it:
usort($chatrooms, function ($a, $b) { return $a['ord'] > $b['ord']; });
3. save and populate the `ord` field on arrowchat_chatroom_rooms with your specific order.
Enjoy,
Fed