blackhill24
blackhill24

Reputation: 452

wp_update_user_meta not updating as expected

I'm having an issue importing users into a new multisite and reassigning them a customer role.

When using:

update_user_meta( $user->id, 'wp_2_capabilities', 'a:1:{s:8:"customer";b:1;}' );

the imported value ends up as

s:25:"a:1:{s:8:"customer";b:1;}";

in PhpMyAdmin.

As a result, the user is added to the multisite but has no role unless i change the value back to a:1:{s:8:"customer";b:1;}

Any help really appreciated.

Upvotes: 0

Views: 109

Answers (1)

Bai Nguyen
Bai Nguyen

Reputation: 834

try this

update_user_meta( $user->id, 'wp_2_capabilities', maybe_unserialize(array('customer'=>1)) )

Upvotes: 1

Related Questions