Advanced search  


2019.06.07 fixed NChat for the "Curve" theme, will eventually move it to its own page and add it to the default theme as well. Other plugins are next. see post in the Meta board for details

Pages: [1]   Go Down

Author Topic: NChat bug fixed  (Read 607 times)


  • Administrator
  • Sr. Member
  • *****
  • Karma: +7/-0
  • Online Online
  • Posts: 158
  • "But what's puzzling you is the nature of my game"
    • LisaEm
NChat bug fixed
« on: June 07, 2019, 09:09:03 am »

Found the bug that was keeping NChat from working, so basically this is caused by differences between postgres and is a WHERE clauses that looks for an empty value using double quotes:
Code: [Select]
140                         WHERE online_color <> ""',
However postfgres wants single quotes here. Was hard to track this down, had to turn on javascript console and then post a message to NChat and then click on HTTP response which had an HTML error of 'ERROR: zero-length delimited identifier at or near' - when I googled that error, I ran into mentioned that it should use single not double quotes.
I fixed the code like so:
Code: [Select]
136         if($onlineColor == NULL){
137                 $request = $smcFunc['db_query']('', '
138                         SELECT id_group, online_color
139                         FROM {db_prefix}membergroups
140                         WHERE online_color <> \'\'',
141                         array(
142                         )
143                 );
which allowed it to work.
NChat is only enabled right now on the "Curve" theme on the main page, so if you'd like to play with it you can switch themes from your Profile > Account Settings > Modify Profile > Look and Layout.
I'll enable it for the default profile as well, though perhaps I'll to add Chat to a different page on the main screen rather than to the Home page.
I suspect there are other such database errors that are caused by postgres being treated as a second class citizen. :( though to be fair, I've no idea if single quotes are ok for mysql in that code. The trouble is these database errors aren't always logged to system logs.
In this case the error was sent back to the web browser as the HTML response, but it turns out that it also made it to the SMF Admin Error log. I've seen other cases where an iPad user could not post that wasn't logged to any log, so I've no way to track it down.  :P :o :(
Perhaps I should have installed this with mysql, but it's too late now.

Fate whispers to the warrior, 'You can not withstand the storm.'  The warrior whispers back, 'I am the storm.'
Pages: [1]   Go Up