Multiple images to the user profile

This topic contains 8 reply and 3 voices, and was last updated by david 10 years, 6 months ago
Viewing 8 Posts - 1 through 8 (of 8 total)
Author Posts
October 13, 2013 at 9:24 pm 8972
david Hi, I upload multiple images to the user profile. What is the code that I need? I need to edit on author.php Thanks.
October 13, 2013 at 10:55 pm 8974
sociallyfamous sociallyfamous

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.

October 14, 2013 at 3:27 am 8982
Tareq Hasan Tareq Hasan

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]

October 16, 2013 at 9:08 pm 9092
david david

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!

October 18, 2013 at 3:33 am 9154
david david

I need someone to help me!
Thanks!!

October 18, 2013 at 9:25 pm 9186
Tareq Hasan Tareq Hasan

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

October 19, 2013 at 3:38 am 9195
david david This reply has been marked as private.
October 19, 2013 at 9:51 pm 9208
Tareq Hasan Tareq Hasan

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

October 21, 2013 at 3:26 am 9234
david david

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

Viewing 8 Posts - 1 through 8 (of 8 total)