ADD NEW BLOCK and Block Type MySQLI error
Permalink...but I now can no longer Add New Blocks. On investigation I discovered that under
DASHBOARD > STACKS & BLOCKS > Block Types
...the following error occurs on the dashboard in the logs and the issue appears to be coming from discussions...
ERROR
mysqli error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 3] in EXECUTE("SELECT uID, uName FROM Users WHERE uLastOnline > 1607522307 ORDER BY uLastOnline DESC LIMIT ")
From the logs, I traced the problem to packages > discussions > blocks > users_online > controller.php (lines 19 and 52).
I have changed line 52 as seen in the commented code but the problem persists.
protected function getArrayOfRecentUsers($since_in_seconds,$number_of_users){ $q = "SELECT uID, uName FROM Users WHERE uLastOnline > ? ORDER BY uLastOnline DESC"; /*$q = 'SELECT uID, uName ' . 'FROM Users ' . 'WHERE ' . 'uLastOnline > ? ' . 'ORDER BY uLastOnline DESC';*/ $v = Array(time()-$since_in_seconds); $db = Loader::db(); $rs = $db->SelectLimit($q,$number_of_users,-1,$v); $users = array(); while ($row = $rs->fetchRow()) { $users[($row['uID'])] = $row['uName'];
I think it is also preventing me from Adding New Blocks.
Can anyone please help as I'm under a lot of pressure to proceed?
For now just two users as I got a lot of spam and deleted the rest.
Try changing line 52 to this
$rs = $db->SelectLimit($q,100000,0,$v);
When I went back to Block Types after clearing the cache I got...
Fatal error: Cannot redeclare class FormBlockController in /home/sites/digitizethis.co.uk/public_html/updates/concrete5.6.3.5_remote_updater/concrete/blocks/form/controller.php on line 3
I installed the discussion package on a dev 5.6 site and modified the controller as per my post.
I am able to browse the Block Types with no problem?
Initially when I look in the network tab I see a 500 error on "edit_area_popup.php?cID=150&arHandle=Sidebar&atask=add&addOnly=0" but now after your suggested change I get a better feedback and a status code of 200 but it has the last error message i notified.
Otherwise, could MariaDB SQL database constitute the problem?
I can edit existing blocks since the concrete5 update, but I can't seem to "Add any new blocks" on any page, hence the reason I visited the Block Types page only to discover the MySQLi error which is consistent with the logs whenever i try to add a new block.
The funny thing is I haven't used the discussions package yet so no customised parts.
I will take a look at the log file image to see if anything can be found that might be causing the errors.
The last message is an old one that was thrown up before you edited the controller file.
You should clear the logs and see if any others pop up later.
I have now resolved the problem.
Following your suggestions yesterday with modifying the discussions file line 52...
I kept getting the following error...
Fatal error: Cannot redeclare class FormBlockController in /home/sites/digitizethis.co.uk/public_html/updates/concrete5.6.3.5_remote_updater/concrete/blocks/form/controller.php on line 3
I then did the following...
First of all I cleared the logs and uninstalled "discussions" package. That made no difference.
Then I removed the concrete folder in the updater (concrete5.6.3.5_updater) and replaced it with a new concrete folder from the concrete5 downloads page [https://www.concrete5.org/download] (version 5.6.3.5) and that made no difference either.
Cleared the cache but no change...
Finally I hesitantly addressed the updater file on line 3 at "./updates/concrete5.6.3.5_remote_updater/concrete/blocks/form/controller.php"
I then changed it from...
to
It now WORKS perfectly.
"Dashboard > Stack & Blocks > BlockTypes" also works.
Now I can also add new blocks with no pending spinners.
Thanks for you kind assistance, it gave me reason to think outside the box.
How many users are listed in the Users database table?