How to set a user meta key value based on another user meta key value

You would need to use a meta query for this. $meta_query_args = array( array( ‘key’ => ‘access_code’, ‘value’ => ‘abc’, ‘compare’ => ‘=’ ) ); $args = array( ‘meta_query’ => $meta_query_args ); $users = get_users( $args ); // User Loop foreach ( $users as $user ) { update_user_meta( $user->ID, ‘association’, ‘XYZ Corporation’); }

get_the_author_meta i want to write in a loop

Your loop rewrite is good so far, yet you can make it better: <?php $at_social_html=”<ul class=”at__social”>”; /* array elements: social-media-name/meta-key => [‘href-before-string’, ‘href-after-string’, ‘fa-class’] */ $author_sociables = array( ‘facebook’ => [”, ”, ‘fa-fb’], ‘twitter’ => [”, ”, ‘fa-twitter’], ‘instagram’ => [”, ”, ‘fa-instagram’], ‘google’ => [‘//plus.google.com/’, ”, ‘fa-google-plus’], ‘pinterest’ => [‘//pinterest.com/’, ”, ‘fa-pinterest’], ‘tumblr’ => … Read more

Display custom image field in user profile

Check out the documentation for ACF image fields: https://www.advancedcustomfields.com/resources/image/ When you use get_field on an image field, it looks like it returns the ID for the image, not a URL. This might have been different in a previous version of ACF. I think something like this might work: $image = get_field(‘user_avatar’, $user->ID’); $size=”full”; // (thumbnail, … Read more

Auto copy value from specific user meta field to another field

You can simply hook function to sync phone number field as following; <?php // HOOK ON REGISTERING NEW USER/CUSTOMER add_action(‘user_register’, ‘mm_sync_phone_number’ , 20, 1); // HOOK ON PERSONAL OPTIONS UPDATE add_action(‘personal_options_update’, ‘mm_sync_phone_number’ , 20, 1); // HOOK ON USER PROFILE UPDATE add_action(‘edit_user_profile_update’,’mm_sync_phone_number’ , 20, 1); function mm_sync_phone_number( $user_id ) { // GET PHONE NUMBER FROM … Read more