We are having a problem with our comments module and need some help getting it fixed. Our comments do not show up on our site and there are no comments in the queue waiting for approval. I can see in the databas that there are comments though.

We are getting the following message on the Comments Module configuration tab:

* warning: array_keys() [function.array-keys]: The first argument should be an array in /home/sportsbu/public_html/modules/user.module on line 351.
* warning: implode() [function.implode]: Bad arguments. in /home/sportsbu/public_html/modules/user.module on line 351.
* user warning: 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 ')' at line 1 query: SELECT DISTINCT(p.perm) FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /home/sportsbu/public_html/includes/database.mysql.inc on line 120.

Please contact me if you are able to help out on this for a reasonable hourly rate.

Comments

anantagati’s picture

You can contact me.

heine’s picture

To allow people to contact you, go to 'my account', tab edit and enable the 'Personal contact form'.
--
The Manual | Troubleshooting FAQ | Tips for posting | Make Backups! | Consider creating a Test site.

kbahey’s picture

Your problem is that the roles in this part of the SQL is empty:

WHERE r.rid IN ()

Note that there is nothing between the brackets.

There is another issue with the user module too.

You have to specify which Drupal version you are using and whether you have customization to it or not.
--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

romand’s picture

The same problem, fresh instalation of 4.7.3 or restoring localhost database (XAMPP1.5.3) on:
Apache/2.2.2 (FreeBSD) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.7e-p1 PHP/5.1.2
MySQL:
Active Persistent Links 0
Active Links 0
Client API version 5.0.21
MYSQL_MODULE_TYPE no value
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_INCLUDE no value
MYSQL_LIBS no value

I have:

* warning: array_keys() [function.array-keys]: The first argument should be an array in /home/portal/modules/user.module on line 351.
* warning: implode() [function.implode]: Bad arguments. in /home/portal/modules/user.module on line 351.
* user warning: 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 ')' at line 1 query: SELECT DISTINCT(p.perm) FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /home/portal/includes/database.mysql.inc on line 120.

Access denied
You are not authorized to access this page.

How to resolve this problem?
With best regards from Ukraine, Roman.

LeeMcL’s picture

I've seen that SELECT DISTINCT... error before. Once where an old 4.6 database had been restored into a 4.7 site. Another time was stranger. The site had a number of extra modules install and if we disabled all the non-standard modules the problem went away. So one of those extra modules was introducing the problem but we were never sure which. A hunt on Google suggested it was either Private Message or Gallary... I thought it could be that Drupal was running out of memory but increasing it didn't seem to help.

Lee
--
Lee McLoughlin
lmmrtech.com

nickeve’s picture

I was having a similar problem with admin created users. My site uses the Legal module which requires users to agree to terms and conditions. For admin created users the agreement bits were missing so the user.module was dying.

I added a conditional to make sure that there are a non zero number of roles being passed to that line before it is triggered. This solved my problem and actually surfaced the legal form on login to those users. Hopefully this is helpful.

if (count($account->roles)>0){
$result = db_query("SELECT DISTINCT(p.perm) FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid WHERE r.rid IN (%s)", implode(',', array_keys($account->roles)));
}