Get the users that my following users are following

You can use the implode function to concatenate array elements: $get_the_following_users = get_user_meta($current_user->ID, ‘following_users’, true); $meta_qssuery = ”; //initialise to an empty string foreach ( $get_the_following_users as $following_user ) { $following_user = get_user_meta($following_user, ‘following_users’, true); if(!empty($following_user)) { //check if any data was returned $meta_qssuery .= implode(‘, ‘, $following_user).’, ‘; } } echo $meta_qssuery; This will … Read more

Copy usermeta value where ID matches in the same table

use this code, it may help you $users = get_users($args); if($users) { foreach($users as $user) { $user_id = $user->ID; $shipping_first_name = get_user_meta($user_id, ‘shipping_first_name’, true); if($shipping_first_name) { update_user_meta( $user_id, ‘first_name’, $shipping_first_name); } } } for $args – refer link https://codex.wordpress.org/Function_Reference/get_users

Adding Author Box Meta Links with Co-Authors

These are outside of the foreach loop: $twitter = get_the_author_meta(‘twitter’, $author_id); $facebook = get_the_author_meta(‘facebook’, $author_id); $googleplus = get_the_author_meta(‘googleplus’, $author_id); $linkedin = get_the_author_meta(‘linkedin’, $author_id); $instagram = get_the_author_meta(‘instagram’, $author_id); $youtube = get_the_author_meta(‘youtube’, $author_id); $email = get_the_author_meta(’email’, $author_id); So (remove that, and) try using $coauthor->ID with get_the_author_meta() like this: <div class=”author-box-social-icons”> <?php if( $email = get_the_author_meta( ’email’, $coauthor->ID … Read more

Cannot Update user meta in custom field

Welcome, either use edit_user_profile_update which is passed user_id add_action(‘edit_user_profile_update’, ‘save_extra_fields_country_institution_user_form’ ); function save_extra_fields_country_institution_user_form($user_id){ # again do this only if you can if(!current_user_can(‘manage_options’) || !current_user_can( ‘edit_user’ )) return false; # save my custom field $result = update_user_meta($user_id, ‘verifier_assign_country’, ‘test3′); } OR when I tested on ‘edit_user_profile’, the whole user object is being passed, not just the … Read more

Displaying user data within ACF relational field (user type)

You don’t actually need to call get_userdata(), all the data you need should be in the relational field array: EDIT: Add post ID and User ID to calls to get_field(). <?php $posts = get_sub_field(‘who_to_show’); if( $posts ): ?> <?php foreach( $posts as $post): setup_postdata($post); $user_info = get_field( ‘relational_user_field’, $post->ID ); $image = get_the_field(‘author_image’, ‘user_’.$user_info->ID ); … Read more

If logged in user views his profile page

You can make use of the get_current_user_id(), get_the_author_meta(‘ID’), and get_edit_user_link() functions. Take the below snippet for instance: if( get_current_user_id() === get_the_author_meta(‘ID’) ){ printf( ‘<a href=”https://wordpress.stackexchange.com/questions/314019/%s”>Edit Profile</a>’, get_edit_user_link() ); } get_current_user_id() will return int(0) if nobody is logged in, or the integer ID of the current user. This effectively removes the need for is_user_logged_in(). get_the_author_meta(‘ID’) will … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)