Hi,

I seem to be getting this error after installing role_weight (before I imported my users) when cron.php runs ..

array_key_exists() [<a href='function.array-key-exists'>function.array-key-exists</a>]: The second argument should be either an array or an object in /home/public_html/sites/all/modules/role_weights/role_weights.module on line 275.

What could be causing this please?

Look forward to any reply, and thank you for this module.

Lilian

Comments

liliplanet’s picture

Priority: Normal » Critical

Hi again,

Just hoping for a resolution of the error in my dblog please ..

array_key_exists() [<a href='function.array-key-exists'>function.array-key-exists</a>]: The second argument should be either an array or an object in /home/public_html/sites/all/modules/role_weights/role_weights.module on line 275.

perke’s picture

I'm having same error when using [heaviest-role-id] token in pathauto settings for automated users paths...it also doesn't add anything in path in this combination of tokens [heaviest-role-id]/[user-raw] to get the users paths in form of rolename/username

using role_weights-6.x-1.5

here is error

warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/user/public_html/sites/all/modules/role_weights/role_weights.module on line 275.

jasont28’s picture

I am also running into this error. I'm not sure if it is actually affecting anything negatively as I cannot find any problems it is causing. Obviously it isn't good to have the error there.

Jason

liliplanet’s picture

Is there perhaps any update on this error please? This module is incomplete .. (and I sponsored the update :)

heyyo’s picture

Same error here. This module is useless to use roles as token in url aliases...

liliplanet’s picture

Please Paul, any update would be greatly appreciated ..

liliplanet’s picture

Please Paul, could you fix the error .. have been waiting for weeks and as you know, very important to my site ..

heyyo’s picture

I don't use this module anymore, I have made my own token, see this post for more information:
http://drupal.org/node/613938

liliplanet’s picture

Heyyo, thank you for your response. I had a look at your post, but don't get it, is that a module? Would you give us a better description of what to do please?

Paul, any news perhaps?

pfaocle’s picture

Please try the line in question to:

if (is_array($roles) && array_key_exists($rid, $roles)) {

Does this fix your problem?

liliplanet’s picture

Hi Paul,

I've just done the patch, and for the past couple of minutes do not see the error, but ...

The sort by role weight in views definitely does not sort by role weight .. I've setup the highest to lowest in roles.

Please Paul, this is so important.

Look forward to hearing from you.
Lilian

liliplanet’s picture

StatusFileSize
new19.12 KB

Attached is my view ..

sterwa’s picture

Hi, it is not just the view that is the problem. After applying the patch in 10 I got the error message to dissapear, but generating autoaliases still does not pick up the token. I am using the following pattern for user accounts:
[lightest-role-id]/[user-raw]
And the paths I get generated look like "user/X" (for X being user ID).
I also tried tokens [heaviest-role], [heaviest-role-id] and [lightest-role] with no success. :/

lejon’s picture

Hi,

I get the same error message as #1 and the token doesn't work.

Is there any maintenance on this module? Last version is 9 months old...

pedrofaria’s picture

StatusFileSize
new1.35 KB

Hello guys...

i was taking a look at this module and fixed the problem....

The problem was that $object is not a user object, but a url alias object... obviously don't have role property...

so, i just fixed putting a user_load function....

Please, review it!

pedrofaria’s picture

Assigned: Unassigned » pedrofaria
Status: Active » Needs review
pfaocle’s picture

Assigned: pedrofaria » Unassigned
Status: Needs review » Closed (duplicate)

Thanks for the patch pedrofaria - will review when I can and continue the Token issue here: #534592: Tokens: [heaviest-role] and [lightest-role] show user id

@Liliplanet: the original array_key_exists error should have been fixed by #529216: Error on new user account submission. Marking this issue as a duplicate. Try the latest 6.x-1.x-dev release to see if it rectifies the problem.