Users are required to login to my site. How define user.member boolean, its permissions, and conditionally display/handle behavior based on it

To store user–specific information WordPress has a user meta, pretty much identical to post meta (also known as custom fields). See get_user_meta() and related functions. Unfortunately WP doesn’t provide any interface or interface helpers for it. You would have to implement that yourself, probably hooking into user profile screen.

Updating meta_value in a custom key

The problem is this line $sales = get_user_meta($_POST[‘repID’], ‘sales’); change it to $sales = get_user_meta($_POST[‘repID’], ‘sales’, true); The last parameter says, that you are getting a single value – an array. Otherwise you get an array inside another array. https://developer.wordpress.org/reference/functions/get_post_meta/ EDIT: After reading the comments, as you have the meta in multiple rows, you should … Read more

Updating custom user meta

You can create a similar solution as the one with a form and submit button by adding an onclick event to your button: <button id=”updateMyUserMeta” name=”updateMyUserMeta” onclick=”window.location.href(‘http://example.com?my_custom_user_meta=true’);”>Update</button> Then add this to the functions.php of your theme. /** * Updates the ‘my_custom_user_meta’ field if the * user clicks the ‘Update’ button. */ function update_my_custom_user_meta() { if … Read more

Confusing problem with displaying message recipient metadata

As I see it, you could replace some things in the switch. You need to open and close , tag in the same case rule, do this avoid a lot error. Like this switch( $column ) { case ‘recipientname’ : <div class=”recipentusername”><a href=”https://wordpress.stackexchange.com/questions/243290/<?php echo um_user_profile_url(); ?>” target=”_blank”><?php _e(“”, ‘front-end-pm’); ?> <?php echo implode( $name );?> … Read more

How to get user meta value in wordpress

You can store the user meta in a variable and check if the variable is empty or not, like below- $args = array( ‘role’ => ‘subscriber’, ‘meta_key’ => ‘user_designation’ ); // The Query $user_query = new WP_User_Query($args); // User Loop $u_meta_array = array(); if ( !empty($user_query->results) ) { foreach ( $user_query->results as $user ) { … Read more