IMPORTANT ADVISE: I SIMPLY PRESENT MY EXIGENCES AND THE (POOR SKILLED) SOLUTIONS I FOUND
I STRONGLY DISCOURAGE TO IMITATE ME IF YOU DON'T KNOW WHAT YOU ARE DOING
MY TARGET IS ONLY TO SHOW HOW FLEXIBLE FLARUM IS
I had this exigence
- The flexibility of a DISCUSSION BOARD with the last post in evidence and so on
- The hard struct of a BLOG with the automatic closing of the discussion after N days
- The closed discussion ordered by publication date and NOT based on the last answer
How did I do that?
FLARUM is so flexible that I could find a solution despite my poor skills
1) A simple php script that runs a mysql query called as CRON JOB
<?php
$con = mysqli_connect('localhost', 'YOUR-DB-NAME, 'YOUR-DB-PASSWORD');
if (!$con) {
die('Could not connect: ' . mysqli_error());
}
echo 'Server connected successfully<br/>';
mysqli_select_db($con, 'pdstzxwr_flarum')
or die('Could not select database.');
mysqli_set_charset($con,"utf8");
echo 'Database connected successfully<br/>';
$sqls = array(
// an array so I can add further query as strings separated by a coma
"UPDATE `flarum_discussions` SET `last_time` =`start_time`, `is_locked` = 1 WHERE DATEDIFF( NOW( ) , `start_time` ) > 2"
);
foreach ($sqls as $sql)
{
echo $sql . '<br/>';
$result = mysqli_query($con, $sql);
if (!$result) {
die('Invalid query: ' . mysqli_error($con));
}
}
/*
$sqlSource = file_get_contents('db-accents.sql');
mysqli_multi_query($con, $sqlSource);
*/
mysqli_close($con);
2) In custom CSS I hided the ordering drop down and the last post date because it becomes equal to start_time
.IndexPage-toolbar {
display: none;
}
time[pubdate='true'] {
display: none;
}