Hi, I'm building a site which uses og_menu. The front page lists nodes which are placed within a group. If I login with a user which is not a member of a group I get this error:
Syntax error or access violation: 1064 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 ')) AND (om.group_type = 'node') )OR( (om.gid IN ('20')) AND (om.group_type = 'u' at line 2: SELECT om.gid AS gid, om.group_type AS group_type, om.menu_name AS menu_name, m.title AS title FROM {og_menu} om INNER JOIN {menu_custom} m ON om.menu_name = m.menu_name WHERE (( (om.gid IN ()) AND (om.group_type = :db_condition_placeholder_0) )OR( (om.gid IN (:db_condition_placeholder_1)) AND (om.group_type = :db_condition_placeholder_2) )); Array ( [:db_condition_placeholder_0] => node [:db_condition_placeholder_1] => 20 [:db_condition_placeholder_2] => user ) in og_menu_get_group_menus() (line 913 of /PATH_TO_SITE/sites/all/modules/contrib/og_menu/og_menu.module).

The error also appears on node/add/FOO.

I've submitted a patch which fixes the problem - I'm a bit unsure if this is the correct approach.

Anyway, it fixes my problem but would like to see it commited to dev or fixed in one way or the other.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rv0’s picture

Status: Needs review » Closed (duplicate)
jseffel’s picture

FileSize
636 bytes
rv0’s picture

Please check the other issue.

Patch does not follow coding standards btw.
It can probably be fixed by

if (!empty($group_gids)) {
    $group_gids_condition = db_and()
      ->condition('om.gid', $group_gids, 'IN')
      ->condition('om.group_type', $group_type, '=');
    $gids_condition->condition($group_gids_condition);
}