Error when new user attempts to register when skype support module is installed
| Project: | Skype Support |
| Version: | HEAD |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Thanks for this module. Looks really great. I"m trying to create a 24 hour crisis support line. So this is fantastic.
So, I've installed Skype Support Module, and it seems to be working OK, in terms of recognizing when people are online / on Skype, etc.. So that's really cool.
However, for some reason, when it is installed, I receive the following error when someone attempts to *register* as a new user on the system.
So here's the behavior:
(1) They're at the user/register page.
(2) They enter their information -- username, password, etc.
(3) They hit submit.
(4) They get this warning page.
Warning: array_keys(): The first argument should be an array in /home/ithou/public_html/modules/user.module on line 378
Warning: implode(): Bad arguments. in /home/ithou/public_html/modules/user.module on line 378
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: user_access SELECT DISTINCT(p.perm) FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /home/ithou/public_html/includes/database.mysql.inc on line 120
Warning: Cannot modify header information - headers already sent by (output started at /home/ithou/public_html/modules/user.module:378) in /home/ithou/public_html/includes/common.inc on line 266(5) It looks like they've actually succesfully established an account, but the warning is strange.
(6) Note: This only happens, bizarrely, when skype support module is enabled.
(7) Note: There was a glitch like this re: a conflict between private message and user.module also, somehow, that got solved when you disable the "display private message link after each post" setting. [see also: http://drupal.org/node/50629 ]
The relevant line 378 in user.module is actually this line, [I added some stuff so that the line #'s are a bit off]:
if (!isset($perm[$account->uid])) {
$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)));Any ideas?
I don't know if it matters that I'm using PHP4? rather than 5?
Thanks for your help.
Albert
www.ithou.org

#1
thanks for using the module :)
I think I know what this is.. I'm going to test my idea and I'll commit a fix soon.
Thanks for the well documented bug.
#2
ok.. something commited.. leaving this open though for a reply on if it fixed it.
I did a quick test and didn't see the error. So more testing could be good. (making a patch was a waste of time for this)
#3
Wow. That's record turnaround time. :-)
I'll give this a shot and let you know how it goes!
Thanks.
#4
:)
it was good timing.
#5
Rats... same error... Hmmm.....
[30 minutes later]
OK, so I've done some more testing. So.... I think I've narrowed it down to the function:
function skypesupport_user($op, &$edit, &$user, $category = NULL)On my system it occurs *only* when... that function is present. [If I take that function out, registration goes on, without a hitch.]
Additionally, the problem seems to lie with the very first line of this function:
$access = user_access('provide skype support', $user);I say this because I observed the following:
(1) if I commented out just this line in the function, the registration worked fine -- without a hitch.
(2) Also: ***if I left this line in, but commented out *every other line* in the function -- I would *still* get the error as reported above. This leads me to believe very strongly that the bug is in this line.
I don't know enough to help here, but I think it's got to be something with this line.
Thanks for your help!
Albert
www.ithou.org
#6
interesting.. well if you can, look more into it and attempt a patch for me.. I'll try again in a day.
#7
I don't know if this messes other stuff up in the program, but the following modification works for me.
<?phpfunction skypesupport_user($op, &$edit, &$user, $category = NULL) {
// $access = user_access('provide skype support', $user);
$access = user_access('provide skype support');
?>
I looked at the error in the private message module that was causing a similar error response, and it seems like when user_access takes a second variable -- that's when the error starts to occur.
In private message:
<?phpfunction privatemsg_link($type, $arg) {
if (user_access('access private messages') && ($type == 'node' || $type == 'comment') && variable_get("privatemsg_link_$type", 0) && (isset($GLOBALS['user']->privatemsg_allow) ? $GLOBALS['user']->privatemsg_allow : 1)) {
//this line below causes the problem -- note the second variable in user_access
if (user_access('access private messages', $arg) && $arg->privatemsg_allow) {
return array(l(t('write to author'), "privatemsg/msgto/$arg->uid"));
}
}
}
?>
Anyhow, I'll keep using it like this and let you know how it handles.
Best,
Albert
#8
fix commited.
thanks for your help.
Your fix wasn't really the right fix, but it showed me the right way. If you review the skypesupport_user() you'll see what I did.
#9
Perfect! Works like a charm!
Thanks a bunch.... :-)
Albert
#10
i may have just noticed another bug.. with the support user list getting broken.
test that for me if you can..
also, i'm adding in the ability to display the user's language incase of sites like drupal.org that support many languages.
I will commit that in a bit.
#11
might be a user.module bug but im leaving this open as it is returned due to the way I have to keep the logic in there.
#12
Hi Steve,
Glad to test stuff out....
Can't seem to see the breaking of the support user list you mentioned, ... at least so far... seems to work, but if I find this happening I'll let you know... [I'm only 1 user and I can't get Skype happening on 2 machines... yet :-) ]
Albert
#13
Hey, there... just fyi,
the 1.9 version doesn't work for me again (same error messages as above when new user attempts to register.) However, 1.8 does work just fine.... I think it's the second variable in user_access which was added back in.... don't know why this is happening.... I tried logging it as an issue with user_access, but was told user_access is fine.
Oh well... I'll just stick with 1.8 for now! ;_)
best,
Albert
#14
Same problem here.
Using Drupal 4.7.1
Where can I get v1.8?
#15
v1.8 is available at:
http://cvs.drupal.org/viewcvs/*checkout*/drupal/contributions/modules/sk...
Upon uploading this file on top of v1.9 problem was solved.
#16
It may not show the error in 1.8 but it's not really doing the check like it is suppose to. Example what I mean..
If you are an admin that has control to change other users profiles, if you go to another users profile, the added skype fields may not appear for you on that other users profiles