Search

Hi guys,

everything was just fine until I used the “sort by name”-link in the section “Members”. I’m using Symphony 2.1.0 with the Members extension 1.2.1beta.

I now get this error when accessing Members in backend:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ed.username asc LIMIT 0, 17’ at line 12

SELECT e.id, e.sectionid, e.author_id, UNIXTIMESTAMP(e.creation_date) AS creation_date, UNIX_TIMESTAMP(e.creation_date_gmt) AS creation_date_gmt FROM sym_entries AS e INNER JOIN sym_entries_data_23 AS ed ON (e.id = ed.entry_id) WHERE 1 AND e.section_id = ‘7’ ed.username asc LIMIT 0, 17

I see that the string

ed.username asc LIMIT 0, 17

in the end of the statement is not correct - but I don’t know how to fix this. Can anybody please help?

Thanks!

ed.username asc LIMIT 0, 17

This in itself looks fine, but is missing the preceding ORDER BY directive. This looks like it’s a bug with the Member field.

Take a look at field.member.php and its buildSortingSQL method:

$sort .= (strtolower($order) == 'random' ? 'RAND()' : "`$sort_field`.`username` $order");

This should be:

$sort .= 'ORDER BY ' . (strtolower($order) == 'random' ? 'RAND()' : "`$sort_field`.`username` $order");

This is what other fields seem to use, so looks like a typo.

I’m hanging on for Symphony 2.2 and Members, there’s too many bugs at the moment…

Thanks nickdunn,

this solved my problem perfectly! But I quiet don’t get it - why didn’t this error happen earlier, when I used the sort field?!

Cheers, Truck

I also encountered the same bug in field.memberrole.php. The buildSortingSQL method must be:

...
$sort .= 'ORDER BY ' . (strtolower($order) == 'random' ? 'RAND()' : "`$sort_field`.`role_id` $order");
...

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details