Changeset 13541 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event.php
- Timestamp:
- 04/16/2024 12:41:37 PM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/event.php
r13529 r13541 12 12 use Wporg\TranslationEvents\Event\Event_End_Date; 13 13 use Wporg\TranslationEvents\Event\Event_Start_Date; 14 use Wporg\TranslationEvents\Stats\Event_Stats; 15 use Wporg\TranslationEvents\Stats\Stats_Row; 14 16 15 17 /** @var Attendee_Repository $attendee_repo */ … … 46 48 <?php foreach ( $contributors as $contributor ) : ?> 47 49 <li class="event-contributor" title="<?php echo esc_html( implode( ', ', $contributor->locales ) ); ?>"> 48 <a href="<?php echo esc_url( get_author_posts_url( $contributor->ID ) ); ?>" ><?php echo get_avatar( $contributor->ID, 48 ); ?></a>49 <a href="<?php echo esc_url( get_author_posts_url( $contributor->ID ) ); ?>" ><?php echo esc_html( get_the_author_meta( 'display_name', $contributor->ID ) ); ?></a>50 <a href="<?php echo esc_url( get_author_posts_url( $contributor->ID ) ); ?>" class="avatar"><?php echo get_avatar( $contributor->ID, 48 ); ?></a> 51 <a href="<?php echo esc_url( get_author_posts_url( $contributor->ID ) ); ?>" class="name"><?php echo esc_html( get_the_author_meta( 'display_name', $contributor->ID ) ); ?></a> 50 52 <?php if ( $stats_calculator->is_first_time_contributor( $event_start, $contributor->ID ) ) : ?> 51 <span class="first-time-contributor-tada" ></span>53 <span class="first-time-contributor-tada" title="<?php esc_html_e( 'New Translation Contributor', 'gp-translation-events' ); ?>"></span> 52 54 <?php endif; ?> 53 55 <?php 54 56 if ( ! $event->end()->is_in_the_past() ) : 55 if ( ( $attendee instanceof Attendee && $attendee->is_host() ) || current_user_can( 'manage_options' ) ) : 56 if ( $user->ID !== $contributor->ID ) : 57 $_attendee = $attendee_repo->get_attendee( $event_id, $contributor->ID ); 58 if ( $_attendee instanceof Attendee ) : 59 echo '<form class="add-remove-user-as-host" method="post" action="' . esc_url( gp_url( "/events/host/$event_id/$contributor->ID" ) ) . '">'; 60 if ( $_attendee->is_host() ) : 61 if ( 1 === count( $attendee_repo->get_hosts( $event_id ) ) ) : 62 echo '<input type="submit" class="button is-primary remove-as-host" disabled value="Remove as host"/>'; 63 else : 64 echo '<input type="submit" class="button is-primary remove-as-host" value="Remove as host"/>'; 65 endif; 66 else : 67 echo '<input type="submit" class="button is-secondary convert-to-host" value="Make co-host"/>'; 68 endif; 69 echo '</form>'; 57 if ( ( $attendee instanceof Attendee && $attendee->is_host() ) || current_user_can( 'manage_options' ) || $user->ID === $event->author_id() ) : 58 $_attendee = $attendee_repo->get_attendee( $event_id, $contributor->ID ); 59 if ( $_attendee instanceof Attendee ) : 60 echo '<form class="add-remove-user-as-host" method="post" action="' . esc_url( gp_url( "/events/host/$event_id/$contributor->ID" ) ) . '">'; 61 if ( $_attendee->is_host() ) : 62 echo '<input type="submit" class="button is-primary remove-as-host" value="Remove as host"/>'; 63 else : 64 echo '<input type="submit" class="button is-secondary convert-to-host" value="Make co-host"/>'; 70 65 endif; 71 elseif ( ( $attendee instanceof Attendee && $attendee->is_host() ) ) : 72 echo '<span class="event-you">' . esc_html__( 'You (host)', 'gp-translation-events' ) . '</span>'; 73 else : 74 echo '<span class="event-you">' . esc_html__( 'You (event creator)', 'gp-translation-events' ) . '</span>'; 66 echo '</form>'; 67 else : 68 echo '<span class="event-not-attending">' . esc_html__( 'Not attending', 'gp-translation-events' ) . '</span>'; 75 69 endif; 76 70 endif; … … 82 76 </div> 83 77 <?php endif; ?> 84 <?php if ( ! empty( $attendees ) && ( ! $event->end()->is_in_the_past() || ( ( $attendee instanceof Attendee && $attendee->is_host() ) || current_user_can( 'manage_options' ) ) ) ) : ?>78 <?php if ( ! empty( $attendees ) && ( ! $event->end()->is_in_the_past() || ( ( $attendee instanceof Attendee && $attendee->is_host() ) || current_user_can( 'manage_options' ) || $user->ID === $event->author_id() ) ) ) : ?> 85 79 <div class="event-attendees"> 86 80 <h2><?php esc_html_e( 'Attendees', 'gp-translation-events' ); ?></h2> … … 88 82 <?php foreach ( $attendees as $_user ) : ?> 89 83 <li class="event-attendee"> 90 <a href="<?php echo esc_url( get_author_posts_url( $_user->ID ) ); ?>" ><?php echo get_avatar( $_user->ID, 48 ); ?></a>91 <a href="<?php echo esc_url( get_author_posts_url( $_user->ID ) ); ?>" ><?php echo esc_html( get_the_author_meta( 'display_name', $_user->ID ) ); ?></a>84 <a href="<?php echo esc_url( get_author_posts_url( $_user->ID ) ); ?>" class="avatar"><?php echo get_avatar( $_user->ID, 48 ); ?></a> 85 <a href="<?php echo esc_url( get_author_posts_url( $_user->ID ) ); ?>" class="name"><?php echo esc_html( get_the_author_meta( 'display_name', $_user->ID ) ); ?></a> 92 86 <?php if ( $stats_calculator->is_first_time_contributor( $event_start, $_user->ID ) ) : ?> 93 <span class="first-time-contributor-tada" ></span>87 <span class="first-time-contributor-tada" title="<?php esc_html_e( 'New Translation Contributor', 'gp-translation-events' ); ?>"></span> 94 88 <?php endif; ?> 95 89 <?php 96 90 if ( ! $event->end()->is_in_the_past() ) : 97 if ( ( $attendee instanceof Attendee && $attendee->is_host() ) || current_user_can( 'manage_options' ) ) : 98 if ( $user->ID !== $_user->ID ) : 99 $_attendee = $attendee_repo->get_attendee( $event_id, $_user->ID ); 100 if ( $_attendee instanceof Attendee ) : 101 echo '<form class="add-remove-user-as-host" method="post" action="' . esc_url( gp_url( "/events/host/$event_id/$_user->ID" ) ) . '">'; 102 if ( $_attendee->is_host() ) : 103 if ( 1 === count( $attendee_repo->get_hosts( $event_id ) ) ) : 104 echo '<input type="submit" class="button is-primary remove-as-host" disabled value="Remove as host"/>'; 105 else : 106 echo '<input type="submit" class="button is-primary remove-as-host" value="Remove as host"/>'; 107 endif; 108 else : 109 echo '<input type="submit" class="button is-secondary convert-to-host" value="Make co-host"/>'; 110 endif; 111 echo '</form>'; 91 if ( ( $attendee instanceof Attendee && $attendee->is_host() ) || current_user_can( 'manage_options' ) || $user->ID === $event->author_id() ) : 92 $_attendee = $attendee_repo->get_attendee( $event_id, $_user->ID ); 93 if ( $_attendee instanceof Attendee ) : 94 echo '<form class="add-remove-user-as-host" method="post" action="' . esc_url( gp_url( "/events/host/$event_id/$_user->ID" ) ) . '">'; 95 if ( $_attendee->is_host() ) : 96 echo '<input type="submit" class="button is-primary remove-as-host" value="Remove as host"/>'; 97 else : 98 echo '<input type="submit" class="button is-secondary convert-to-host" value="Make co-host"/>'; 112 99 endif; 113 elseif ( ( $attendee instanceof Attendee && $attendee->is_host() ) ) : 114 echo '<span class="event-you">' . esc_html__( 'You (host)', 'gp-translation-events' ) . '</span>'; 115 else : 116 echo '<span class="event-you">' . esc_html__( 'You (event creator)', 'gp-translation-events' ) . '</span>'; 100 echo '</form>'; 117 101 endif; 118 102 endif; … … 215 199 array_map( 216 200 function ( $contributor ) use ( $stats_calculator, $event_start ) { 217 $append_tada = $stats_calculator->is_first_time_contributor( $event_start, $contributor->ID ) ? '<span class="first-time-contributor-tada"></span>' : ''; 201 $append_tada = ''; 202 if ( $stats_calculator->is_first_time_contributor( $event_start, $contributor->ID ) ) { 203 $append_tada = '<span class="first-time-contributor-tada" title="' . esc_html__( 'New Translation Contributor', 'gp-translation-events' ) . '"></span>'; 204 } 218 205 return '@' . $contributor->user_login . $append_tada; 219 206 }, … … 225 212 'span' => array( 226 213 'class' => array(), 214 'title' => array(), 227 215 ), 228 216 ) … … 258 246 <form class="event-details-attend" method="post" action="<?php echo esc_url( gp_url( "/events/attend/$event_id" ) ); ?>"> 259 247 <?php if ( $attendee instanceof Attendee ) : ?> 260 <?php if ( $attendee->is_host() && ( 1 === count( $attendee_repo->get_hosts( $event_id ) ) ) ) : ?> 261 <input type="submit" class="button is-secondary attending-btn" disabled value="You're attending" /> 262 <?php else : ?> 263 <input type="submit" class="button is-secondary attending-btn" value="You're attending" /> 264 <?php endif; ?> 248 <input type="submit" class="button is-secondary attending-btn" value="You're attending" /> 265 249 <?php else : ?> 266 250 <input type="submit" class="button is-primary attend-btn" value="Attend Event"/>
Note: See TracChangeset
for help on using the changeset viewer.