| User | Post |
|
8:25 am November 12, 2009
| David
Member
| | | |
|
| posts 4 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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?
|
|