• Resolved aknahin113

    (@aknahin113)


    I am using ACF to show different dynamic values in the user dashboard. All the other fields are working fine. But when I want to show a dynamic image then it creates problem. I am useing elementor pro. So I thing it is a problem with elementor pro and ACF. So I go for custom code. At first I add a custom image field for a post, and use this code.

    <?php
    $image = get_field($post_image); 
    $pic = $image['sizes']['large'];
    ?>
    
    <p><?php echo $pic; ?></p>
    <?php var_dump($image);?>

    and this code is working fine. But when I try to show image of a user with a code. it just shows me image id, not image. all image ACF settings are same for both post and user image field.

    there is two code: one is:

    
    <?php
    $user_id = get_current_user_id();
    $user = get_user_by( 'id', $user_id);
    $userimg = get_field("$realtor_image",$user);
    if( $userimg ) {
        echo $userimg;
    } else {
        echo 'empty';
    }
    ?>

    another is:

    <?php
    $user_id = get_current_user_id();
    $user = get_user_by( 'id', $user_id);
    $userimg = $user->realtor_image; 
    ?>
    
    <p><?php echo $user->realtor_image; ?></p>
    <?php var_dump($userimg);?>

    and in the screenshot, you will see those above the line and below the like. Can anyone please help me?
    Output ss: https://imgur.com/a/dPWqOoK
    Here is my image field ss: https://imgur.com/a/MQxca3m

    I am trying to show the image that is different from user to user, like what ACF actually does, showing dynamic content. I can do it for posts, but not for logged-in users. It is showing me the image id rather than the actual image. I have changed Return Format, but not work.

Viewing 1 replies (of 1 total)
  • Hi @aknahin113

    ACF Support Team here. This forum is generally used by ACF users helping each other out.

    However, we would love to continue investigating and troubleshooting this issue, please can you create a ticket using our support form and we can look into it further.

Viewing 1 replies (of 1 total)
  • The topic ‘ACF dynamic image field for user is not working on webpage’ is closed to new replies.