ID;
$size = array(250,250);
$args = array(
‘post_type’ => ‘attachment’,
‘numberposts’ => -1,
‘post_status’ => null,
‘post_parent’ => null, // any parent
‘author’=> $user_id,
);
$attachments = get_posts($args);
$pdfs_name = array();
$pdfs_url = array();
//loop through all attachments for logged in user
foreach ($attachments as $post) {
$url = wp_get_attachment_url($post->ID, false);
$url_parts = explode(“/”,$url);
$index = count($url_parts)-1;
//put pdfs in array to display below
if( substr($url_parts[$index],-4) == “.pdf” )
{
array_push( $pdfs_name , $url_parts[$index] );
array_push( $pdfs_url , $url );
}
}
}
if ($attachments && is_user_logged_in() )
{
?>

Welcome display_name;?>!

You may view and download any of the following items:

Please log in to view this page, in the mean time why not visit out Homepage

“;
?>