• I want to show a file that was uploaded by the logged in user.

    it is uploaded to a file called “proposals” and on the author page or in another page called “your proposal”, I want to show the link for the uploaded file only from that user.

    How can I do that? I’ve tried to user wp_current_user() but I don’t know how to show the file permalink.

    Can anyone help me? ??

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • This plugin might help you accomplish your goal:
    Custom Upload Dir

    Cheers!

    Olá,
    this will list all the files uploaded by the current user:

    $current_user = wp_get_current_user();
    if ( 0 != $current_user->ID ) {
    	echo '<ul>';
    	$args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'author' => $current_user->ID );
    	$myposts = get_posts( $args );
    	foreach( $myposts as $post ) :	setup_postdata($post);
    		?><li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li><?php
    	endforeach;
    	echo '</ul>';
    }

    Thread Starter Marta86

    (@marta86)

    Thank you so much! I’ll try it ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show users' uploaded files’ is closed to new replies.