• Hi,

    I created a contributor account for one of my collaborators.
    This account is just for putting pictures in drag and drop.
    What I would like to do is to post on another page “remember” the photos he has put on his profile.

    I tryed on this code base that I already used but it does not work ..

    <?php
    $user_id = um_get_requested_user();
    um_fetch_user( $user_id );
    $meta_value = get_user_meta( $user_id, ‘photonbre2’, true );
    if ( $meta_value ) {
    echo ‘uploader()->get_upload_base_url() . um_user( ‘id’ ) . “/” . $meta_value . ‘” />’;
    }
    ?>

    Do you have any idea ?

    Regards

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter throm17

    (@throm17)

    I tryed on select directly the id of user correspond, but it don’t working.

    $Francois75 = um_get_requested_user();
    um_fetch_user( $Francois75 );
    $meta_value = get_user_meta( $Francois75, ‘photonbre2’, true );
    if ( $meta_value ) {
    echo ‘uploader()->get_upload_base_url() . um_user( ‘Francois75’ ) . “/” . $meta_value . ‘” />’;
    }
    ?>

    Do you have any idea ?

    @throm17

    • If you want the image tag, you should check if the file exist then output the img tag.
    • Also, that method looks like it is missing the main UM function.
    • Inside of um_user, you needed to mention ID as a string not add the dynamic ID
    
    $Francois75 = um_get_requested_user();
    um_fetch_user( $Francois75 );
    $meta_value = get_user_meta( $Francois75, 'photonbre2', true );
    if ( $meta_value ) {
      $file_path = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . '/' . $meta_value;
      if ( file_exists( $file_path ) {
         echo sprintf( '<img src="%s" />', esc_url( $file_path ) );
      }
    }
    
    Thread Starter throm17

    (@throm17)

    Hi @suiteplugins,

    Thanks for your answer, but this code don’t allow to display a picture..

    Do you have any over idea ?

    Regards.

    @throm17

    It all depends on how things are saved and stored. I suggest debugging each line and checking to see that you are receiving the correct data and the correct format /type that you expect.

    Thread Starter throm17

    (@throm17)

    @suiteplugins

    Ok, thanks, i’m going to verify this.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display picture of user’ is closed to new replies.