When a user registers on our site, they are getting this error:
warning: array_keys(): The first argument should be an array in /home/election/public_html/modules/user.module on line 348.
warning: implode(): Bad arguments. in /home/election/public_html/modules/user.module on line 348.
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 main_role r INNER JOIN main_permission p ON p.rid = r.rid WHERE r.rid IN () in /home/election/public_html/includes/database.mysql.inc on line 120.
I did some searching on this site, but everything I could find talked about the privatemessage module. We do not have that one installed.
Any idea what's causing this? I've made no changes to the user.module.
Comments
Comment #1
AjK commentedPatch attached that fixes this.
best regards,
--AjK
Comment #2
AjK commentedAnd a DRUPAL-4-7 version of the patch as the previous one (for cvs version) didn't apply
best regards,
--AjK
Comment #3
killes@www.drop.org commentedI think we need to ensure that the roles array has at least one element for the query to not throw an error. Also, I'd like to know why we get the error at all, ie I'd like to see it fixed where it occurs.
Comment #4
AjK commentedkilles, fair point. I've had a look at the code and really can't see why $account->roles would become unset. In fact, the code between DRUPAL-4-7 and HEAD appears the same. So, the problem I have is I cannot reproduce jsimonis's problem as described.
I can only assume that another module is clobbering it somehow. But, without jsimonis's setup, then all I can offer is that jsimonis use the patches to protect against the error occuring. And that means they obviously shouldn't be applied to cvs (as you pointed out).
So, jsimonis, if you want a proper fix, you'll need to supply more info (like what modules you have installed) so that I and others can reproduce your problem.
best regards
--AjK
Comment #5
jsimonis commentedI played with it all night and finally figured it out. It's the cpanel module that's making the errors pop up.
Comment #6
AjK commentedComment #7
floydk commenteddoes this patch just need to be added to the end of the users.module file? or is there a certain area for it - sorry if the question is dumb, I'm a newbie.
Comment #8
yecarrillo commentedI'm trying to catch the code causing this error.
I just can see that consecutive calls to $account = user_load(array('uid' => $user->uid, 'status' => 1)); may be causing this problem.
Another thing is that I buld a form outside of $type selection. This means calling this routine on every call of cpanel_user hook.
Please somebody with 4.7 API experience can review my code of user hook to find other strange things.
Comment #9
ekul08 commentedThanks for this patch! Works a beauty!
To install this patch: first make 2 copies of user.module (one for a backup, one to edit)
Oped the one to edit. Hit Ctrl + F and find the line where it says
then, delete that line, and the two line's under it (the one that starts with @result =, and the one that starts with $perm) then replace it with the following lines of code:
Comment #10
Transformis commentedYes!
Wonderful work with that patch. Thank you!
Comment #11
AjK commentedI'd like to point out to those using this patch that all it does is make the user interface related problem "disappear". As killes pointed out above, it doesn't fix/cure the underlying problem.
Comment #12
clubsparkle commentedI am having similar issues, has this been fixed?
Comment #13
AjK commentedLast commit to project May 26, 2006. Dead project and issue queue?