Hello,
the module gravatar was working nice for me until i had to change the provider. I did a backup/migrate of databases, and all seems ok, except that gravatar with organic groups : when i go to an organic group faces, and if this group contains user with gravatar icons, i can't see the gravatar icons (only drupal icons) and i have got these warnings :
* warning: array_fill() [function.array-fill]: Number of elements must be positive in /var/www/drupal/includes/database.inc on line 241.
* warning: implode() [function.implode]: Invalid arguments passed in /var/www/drupal/includes/database.inc on line 241.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/drupal/modules/user/user.module on line 502.
* 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 p.perm FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /var/www/drupal/modules/user/user.module on line 502.
* warning: array_fill() [function.array-fill]: Number of elements must be positive in /var/www/drupal/includes/database.inc on line 241.
* warning: implode() [function.implode]: Invalid arguments passed in /var/www/drupal/includes/database.inc on line 241.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/drupal/modules/user/user.module on line 502.
* 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 p.perm FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /var/www/drupal/modules/user/user.module on line 502.
* warning: array_fill() [function.array-fill]: Number of elements must be positive in /var/www/drupal/includes/database.inc on line 241.
* warning: implode() [function.implode]: Invalid arguments passed in /var/www/drupal/includes/database.inc on line 241.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/drupal/modules/user/user.module on line 502.
* 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 p.perm FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /var/www/drupal/modules/user/user.module on line 502.
* warning: array_fill() [function.array-fill]: Number of elements must be positive in /var/www/drupal/includes/database.inc on line 241.
* warning: implode() [function.implode]: Invalid arguments passed in /var/www/drupal/includes/database.inc on line 241.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/drupal/modules/user/user.module on line 502.
* 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 p.perm FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /var/www/drupal/modules/user/user.module on line 502.
* warning: array_fill() [function.array-fill]: Number of elements must be positive in /var/www/drupal/includes/database.inc on line 241.
* warning: implode() [function.implode]: Invalid arguments passed in /var/www/drupal/includes/database.inc on line 241.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/drupal/modules/user/user.module on line 502.
* 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 p.perm FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /var/www/drupal/modules/user/user.module on line 502.
* warning: array_fill() [function.array-fill]: Number of elements must be positive in /var/www/drupal/includes/database.inc on line 241.
* warning: implode() [function.implode]: Invalid arguments passed in /var/www/drupal/includes/database.inc on line 241.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/drupal/modules/user/user.module on line 502.
* 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 p.perm FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /var/www/drupal/modules/user/user.module on line 502.
* warning: array_fill() [function.array-fill]: Number of elements must be positive in /var/www/drupal/includes/database.inc on line 241.
* warning: implode() [function.implode]: Invalid arguments passed in /var/www/drupal/includes/database.inc on line 241.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/drupal/modules/user/user.module on line 502.
* 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 p.perm FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /var/www/drupal/modules/user/user.module on line 502.
What is missing ?
Regards,
Raphaël
Comments
Comment #1
dave reidThat's really odd. What I can guess is happening is that an incomplete user object is being passed into user_access(), which is what is causing the errors your are seeing. If you could modify your modules/user/user.module file around line 502 and add:
Comment #2
satcom74 commentedHad that same problem on Members faces with 6.x-1.6 and 1.x-dev. I was using the stock members faces with OG. I had to go back to 6.x-1.5 to get it to work again.
Comment #3
ashledombos commentedSorry for long answer, i was ill :)
so i did it, i add the line, and now i have
And so on, for each user that have not a profile picture (uid 49, in my example, does not have a picture)
Raphaël
Comment #4
dave reidOk, yeah that's definitely an incomplete user data. It should have an object variable 'roles' which is used by user_access(), and that function is used by gravatar. I'll try and get a test og installed and see if I can solve this.
Comment #5
ashledombos commentedthank you very much, i think the database must have loose something during the migration :/
Comment #6
ashledombos commentedBTW, do you know a way to fix the database by hand or with a script ?
Comment #7
dave reidI got og installed and running on my local install and committed a temporary fix for this. The main problem is if you have a view (via Views) that users a 'user picture' field display, it does not provide the full user object (like from user_load()) which has all the role data available for permission checking. I'm going to file an issue for View to hopefully fix this in the future, but I'll also leave this fix in the Gravatar code for a while just in case.
Considering fixed!
http://drupal.org/cvs?commit=225066
Comment #8
dave reidFor those interested I filed an issue with Views at #491082: Provide a fully-loaded user object with the user picture field.
Comment #10
millenniumtreeYou also get this error from other modules if your anonymous user doesn't have a uid of 0.
Check your 'users' table and make sure the user with no username has a uid of 0.
If someone loaded a database dump, it's possible the anonymous user got created with an auto-incremented, non-zero uid.