get_user can’t read variable
Needs double quotes $WhoIsUser = get_users( array( ‘meta_key’ => ‘deviceid’, ‘meta_value’ => “$deviceid” ) );
Needs double quotes $WhoIsUser = get_users( array( ‘meta_key’ => ‘deviceid’, ‘meta_value’ => “$deviceid” ) );
Try below code: add_action( ‘user_register’, ‘create_new_post_onuser_registration’, 10, 1 ); function create_new_post_onuser_registration( $user_id ){ // Get user info $user_meta = get_userdata( $user_id ); $user_roles = $user_meta->roles; // Update the role here if ( in_array( ‘subscriber’, $user_roles ) ) { // Do something. // Create a new post $subscriber_post = array( ‘post_title’ => $user_meta->nickname; ‘post_content’ => $user_meta->description, … Read more
If you want to update meta on registration like this I think a better option would be to use the register_new_user hook with add_action. https://developer.wordpress.org/reference/hooks/register_new_user/ So something like: add_action(‘register_new_user’,’my_update_meta’,10,1); function my_update_meta($user_id){ update_user_meta($user_id, ‘show_admin_bar_front’, false); } If in doubt, hooks/filters/actions tend to be the best option for WordPress work.
Not long after posing this question I figured it out. But since I had spent a few hours looking for the awswer I thought maybe it would be worth posting. I hope this does not break any rules. I changed the default priority from 10 to 11. as per: add_action( ‘profile_update’, ‘initiate_participant_profile_update’, 10, 2 ); … Read more
You want to use the WordPress function; add_user_meta add_user_meta( $user_id, ‘_level_of_awesomeness’, $awesome_level); https://developer.wordpress.org/reference/functions/add_user_meta/
So the problem with either post meta or user meta is that if your key is e.g. _group_members_value_key you only have one item of data per user or per post in which to store the data, and you need many items for each user and many items for each post. This is two columns of … Read more
How to do WP_User_Query for Nested Array value Inside Nested Array field
Since you’re using a JWT for the current user (that is logged into WordPress), you can use this endpoint: /wp/v2/users/me https://developer.wordpress.org/rest-api/reference/users/#retrieve-a-user-2 You can also check the token to see what claims are available at https://jwt.ms
wp_redirect sends a HTTP header to the browser. Once HTTP headers are sent, that’s it, they’re gone, you can’t add anymore. However, you called get_header and rendered some HTML. To do this headers need to be sent to the browser telling it to expect a HTML page. So by the time you load edit-profile-proccess.php, it’s … Read more
Admin user column sort by numeric meta key