Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Integration Problem / bug wp / rolescoper / amember

UserPost

8:25 am
November 12, 2009


David

Member

posts 4

1

Hello, 


I set up a membership site using amember and wp and so far everything works.

If a member gets multiple products assigned that should give him more than one wordpress role. And in this case I get the following error message:

Warning: array_intersect_key() [function.array-intersect-key]: Argument #1 is not an array in ../role-scoper/roles_rs.php on line 330


Warning: array_diff_key() [function.array-diff-key]: Argument #1 is not an array in ../role-scoper/roles_rs.php on line 264


Warning: array_diff_key() [function.array-diff-key]: Argument #1 is not an array in ../role-scoper/roles_rs.php on line 264


Warning: array_diff_key() [function.array-diff-key]: Argument #1 is not an array in ../role-scoper/roles_rs.php on line 264


Any Idea how to fix this or where to start looking? 

Seems that $roles is not an array…


Please help!

8:51 am
November 12, 2009


Kevin

Admin

posts 2402

2

David said:

I set up a membership site using amember and wp … If a member gets multiple products assigned that should give him more than one wordpress role. And in this case I get the following error message:


Warning: array_intersect_key() [function.array-intersect-key]: Argument #1 is not an array in /home/berggold/public_html/jambam/wp-content/plugins/role-scoper/roles_rs.php on line 330

Seems that $roles is not an array…


It looks to me like your $roles->capabilities is an empty array because AMember has created a role that has no capabilities whatsoever. You can modify Role Scoper to deal with that:

in roles_rs.php, change:

$caps = array_intersect($role->capabilities, array(true) );

$caps = array_intersect_key($role->capabilities, array_flip($this->cap_defs->get_all_keys()) );

to:

if ( $caps = array_intersect( $role->capabilities, array(true) ) )
   $caps = array_intersect_key( $caps, array_flip($this->cap_defs->get_all_keys() ) );

12:06 pm
November 12, 2009


David

Member

posts 4

3

thx for your quick response. 


unfortunately this didn't solve the problem. what else could be the problem?


- David

12:25 pm
November 12, 2009


Kevin

Admin

posts 2402

4

David said:

thx for your quick response. 


unfortunately this didn't solve the problem. what else could be the problem?



Then try

$caps = array_intersect( $role->capabilities, array(true) );

if ( $caps && is_array($caps) )
   $caps = array_intersect_key( $caps, array_flip($this->cap_defs->get_all_keys() ) );

12:38 pm
November 12, 2009


David

Member

posts 4

5

Gives me this: 


Warning: array_intersect() [function.array-intersect]: Argument #1 is not an array in …/wp-content/plugins/role-scoper/roles_rs.php on line 333

Line: $caps = array_intersect($role->capabilities, array(true) );


Warning: array_diff_key() [function.array-diff-key]: Argument #1 is not an array in ../wp-content/plugins/role-scoper/roles_rs.php on line 264

Warning: array_diff_key() [function.array-diff-key]: Argument #1 is not an array in /../wp-content/plugins/role-scoper/roles_rs.php on line 264


Any idea?

1:03 pm
November 12, 2009


Kevin

Admin

posts 2402

6

Okay, I should have given you this in the first place…

if ( is_array( $role->capabilities ) ) {
   $caps = array_intersect( $role->capabilities, array(true) );

   if ( $caps && is_array($caps) )
     $caps = array_intersect_key( $caps, array_flip($this->cap_defs->get_all_keys() ) );
} else
   $caps = array();

1:07 pm
November 12, 2009


David

Member

posts 4

7

Awesome! You fixed it!

Thank you so much, would have sure cost me a whole day…

All the best to you

-David

1:12 pm
November 12, 2009


Kevin

Admin

posts 2402

8

David said:

Awesome! You fixed it!

Thank you so much, would have sure cost me a whole day…

All the best to you

-David


Great. Did the line 264 warnings go away too?


About the Agapetry forum

Currently Online:

12 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1186

Posts: 5409

Members:

There are 1176 members

There are 1 guests


Kevin has made 2402 posts

Top Posters:

metal450 - 159

Ragnar - 105

YikYak - 70

whiteorb - 44

Daisy - 35

Administrator: Kevin | Moderators: Kevin