[support] Comment/Settings page error
Earnie Boyd
earnie at users.sourceforge.net
Fri Nov 30 13:33:49 UTC 2007
Quoting sander-martijn <lists at severeddreams.com>:
> On second look it appears $placeholders isn't getting populated, so you
> should look for what $placeholders SHOULD be.
>
> Error:
> SELECT DISTINCT( p.perm) FROM role r INNER JOIN permission p ON p.rid =
> r.rid WHERE r.rid IN ()
>
> SQL code:
> SELECT DISTINCT(p.perm) FROM {role} r INNER
> JOIN {permission} p ON p.rid = r.rid WHERE r.rid IN ($placeholders)
>
> and from the code you showed in a different email $placeholders should
> be an array of account role ids:
> $rids = array_keys($account->roles);
> $placeholders = implode(',', array_fill(0, count($rids), '%d'));
>
This code is only reached if $user->uid is not 1 and
$perm[$account->uid] is not already set. If you're logged in then it
is already set for the normal use of the user_access function. Some
module may pass in a user object to check that user for permissions but
that shouldn't be the case; is it?
> so view the content of your roles table - because apparently there
> aren't any roles or it's not getting populated for some other reason.
> If there are roles, try the following SQL in phpMyAdmin SQL execution
> (there's an SQL tab just click that and paste this in):
> SELECT DISTINCT(p.perm) FROM `role` r INNER
> JOIN `permission` p ON p.rid = r.rid WHERE r.rid IN (1,2,3,4)
>
> Note I replaced the {} with `` and replaced $placeholders with a comma
> separated list of role ids from my installation - I have 4 roles and
> therefore 4 role ids - you'll have to check your roles table to find out
> what your list should be. In my case I get 4 results when running that
> query and they look like this:
>
There are two default roles, anonymous and authenticated.
Earnie -- http://for-my-kids.com/
-- http://give-me-an-offer.com/
More information about the support
mailing list