Changeset 13985
- Timestamp:
- 08/20/2024 04:29:09 AM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/uploads.php
r13983 r13985 81 81 // Enqueue scripts. 82 82 add_action( 'wp_enqueue_scripts', [ __CLASS__, 'wp_enqueue_scripts' ] ); 83 // Adds user's recent submissions above upload form. 84 add_filter( 'wporg_photos_pre_upload_form', [ __CLASS__, 'output_user_recent_submissions' ] ); 83 85 // Disable upload form and show message if user not allowed to upload. 84 86 add_filter( 'the_content', [ __CLASS__, 'insert_upload_disallowed_notice' ], 1 ); … … 888 890 if ( is_page( self::SUBMIT_PAGE_SLUG ) ) { 889 891 $content .= apply_filters( 'wporg_photos_pre_upload_form', $content ); 890 891 if ( User::count_published_photos( get_current_user_id() ) ) {892 $content .= sprintf(893 /* translators: %s: URL to current user's photo archive. */894 '<p>' . __( 'View <a href="%s">your archive of photos</a> to see what you’ve already had published.', 'wporg-photos' ) . '</p>',895 get_author_posts_url( get_current_user_id() )896 );897 }898 892 899 893 $content .= '<fieldset id="wporg-photo-upload">'; … … 1015 1009 return $transforms; 1016 1010 } 1011 1012 /** 1013 * Adds current user's 6 most recent photo submissions above upload form. 1014 * 1015 * @param string $content Existing content before the upload form. 1016 * @return string 1017 */ 1018 public static function output_user_recent_submissions( $content ) { 1019 // Bail if user does not have any published photos. 1020 if ( ! User::count_published_photos( get_current_user_id() ) ) { 1021 return $content; 1022 } 1023 1024 $recent_photos = User::get_recent_photos( get_current_user_id(), 6, false ); 1025 if ( $recent_photos ) { 1026 $content .= '<h2 class="latest-photos">' . esc_html__( 'Your latest published photos', 'wporg-photos' ) . '</h2>' . "\n"; 1027 $content .= '<div class="photos-grid">' . "\n"; 1028 1029 foreach ( $recent_photos as $photo ) { 1030 $content .= Template_Tags\get_photo_as_grid_item( $photo, 'medium', 'post' ); 1031 } 1032 1033 $content .= "</div>\n"; 1034 } 1035 1036 $content .= sprintf( 1037 /* translators: %s: URL to current user's photo archive. */ 1038 '<p>' . __( 'View <a href="%s">your archive of photos</a> to see everything you’ve already had published.', 'wporg-photos' ) . '</p>', 1039 esc_url( get_author_posts_url( get_current_user_id() ) ) 1040 ); 1041 1042 return $content; 1043 } 1044 1017 1045 } 1018 1046
Note: See TracChangeset
for help on using the changeset viewer.