-
Henry Wright replied to the topic How to assign a WP user role based on a registration in the forum How-to & Troubleshooting 9 years, 10 months ago
Hi @youmin
My post was this:
Just to point out, you can’t use or in PHP. Instead you should use a double pipe like this ||.
This is wrong! You can in fact use the
or
operator in PHP, it just takes a lower precedence than||
.Hence why I deleted my post.
Hope that clears things up.
-
Henry Wright replied to the topic How to assign a WP user role based on a registration in the forum How-to & Troubleshooting 9 years, 10 months ago
Hi @youmin
My post was this:
Just to point out, you can’t use
or
in PHP. Instead you should use a double pipe like this||
.This is wrong! You can in fact use the
or
operator in PHP, it just takes a lower precedence than||
.Hence why I deleted my post.
Hope that clears things up.
-
Henry Wright replied to the topic How to assign a WP user role based on a registration in the forum How-to & Troubleshooting 9 years, 10 months ago
Hi @youmin
My post was this:
Just to point out, you can’t use
or
in PHP. Instead you should use a double pipe like this||
. So your code becomes:if ( ( $userdata['role'] == "subscriber" ) || ( $userdata['role'] == "contributor" ) )
wp_update_user( $userdata );This is wrong! You can in fact use the
or
operator in PHP, it just takes a l…[Read more] -
Henry Wright replied to the topic How To bp_set_member_type? in the forum Creating & Extending 9 years, 10 months ago
Hi @youmin
If you don’t already have your roles set-up then this is how you’d add them:
add_role(
'student',
__( 'Student' ),
array(
'read' => true, // true allows this capability
'edit_posts' => true,
'delete_posts' => false, // Use false to explicitly deny
)
);The 3rd parameter is where…[Read more]
@youmin
Active 8 years, 9 months ago