function pronamic_user_image($user) { ?> <h3><?php _e('Media', 'pronamic_framework'); ?> </h3> <table class="form-table"> <tr> <th> <label for="user_image"> <?php _e('Profile Image', 'pronamic_framework'); ?> </label> </th> <td> <?php pronamic_media_select_field('_pronamic_image_id', pronamic_get_user_image_id($user->ID)); ?> <span class="description"><?php _e('Select an image from the media library. This may be shown publicly.', 'pronamic_framework'); ?> </span> </td> </tr> </table> <?php }
/** * Retrieve User Image. * * @param int $user_id * @param string|array $size * @param string|array $attr */ function pronamic_get_the_user_image($user_id = null, $size = 'post-thumbnail', $attr = '') { $user_id = null === $user_id ? get_the_author_meta('ID') : $user_id; $user_image_id = pronamic_get_user_image_id($user_id); if ($user_image_id) { $html = wp_get_attachment_image($user_image_id, $size, false, $attr); } else { $html = ''; } return $html; }