Home Forums Plugin Support WP User Frontend (Free Version) Multiple images to the user profile

This topic is: resolved

Tagged: ,

This topic contains 8 replies, has 3 voices, and was last updated by  david 5 years, 9 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #8972

    david
    Participant
    Post count: 40

    Hi,

    I upload multiple images to the user profile. What is the code that I need?
    I need to edit on author.php

    Thanks.

    #8974

    sociallyfamous
    Participant
    Post count: 91

    Good question. I haven”t been able to figure that out. I uploaded an additional image to the user profile meta but I do not manage to call the image into the sidebar. Lets see if you can help.

    #8982

    Tareq Hasan
    Keymaster
    Post count: 2831

    Following this topic, for multiple images, this code should work:

    [php]
    $images = get_user_meta( $curauth->ID, ‘mey_key_name' );
     
    if ( $images ) {
        foreach ( $images as $attachment_id ) {
            $thumb = wp_get_attachment_image( $attachment_id, ‘thumbnail' );
            $full_size = wp_get_attachment_url( $attachment_id );
     
            printf( ‘<a href="%s">%s</a>', $full_size, $thumb );
        }
    }
    [/php]

    #9092

    david
    Participant
    Post count: 40

    I don't work with $curauth…
    It's posible to $user_id?:

    <?php
    $images = get_user_meta( $user_id, 'mey_key_name' );
     
    if ( $images ) {
        foreach ( $images as $attachment_id ) {
            $thumb = wp_get_attachment_image( $attachment_id, 'thumbnail' );
            $full_size = wp_get_attachment_url( $attachment_id );
     
            printf( '<a href="%s">%s</a>', $full_size, $thumb );
        }
    }
    ?>

    Thanks!

    #9154

    david
    Participant
    Post count: 40

    I need someone to help me!
    Thanks!!

    #9186

    Tareq Hasan
    Keymaster
    Post count: 2831

    Can you paste your themes authors.php code in pastebin.com?

    #9195

    david
    Participant
    Post count: 40
    This reply has been marked as private.
    #9208

    Tareq Hasan
    Keymaster
    Post count: 2831

    Paste the snippet at the top of the page:
    [php]
    if ( isset( $_GET[‘author_name'] ) ) {
    $curauth = get_userdatabylogin( $author_name );
    } else {
    $curauth = get_userdata( intval( $author ) );
    }
    [/php]

    Now you can use the code above I gave you using $curauth

    #9234

    david
    Participant
    Post count: 40

    Works, Tareq!
    Thank you very much for your effort and dedication.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Multiple images to the user profile’ is closed to new replies.