Changeset 13683 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-header.php
- Timestamp:
- 05/09/2024 08:33:51 AM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/templates/events-header.php
r13541 r13683 3 3 namespace Wporg\TranslationEvents; 4 4 5 use GP;5 use WP_User; 6 6 use Wporg\TranslationEvents\Attendee\Attendee; 7 7 use Wporg\TranslationEvents\Event\Event; 8 8 9 /** @var WP_User $user */ 10 /** @var Attendee[] $hosts */ 9 11 /** @var Attendee $attendee */ 10 /** @var Event $event */12 /** @var Event $event */ 11 13 /** @var string $event_page_title */ 12 /** @var bool $is_editable_event */13 14 ?> 14 15 … … 22 23 <ul class="event-list-nav"> 23 24 <?php if ( is_user_logged_in() ) : ?> 24 <li><a href="<?php echo esc_url( gp_url( '/events/my-events/' ) ); ?>">My Events</a></li> 25 <?php 26 /** 27 * Filter the ability to create, edit, or delete an event. 28 * 29 * @param bool $can_crud_event Whether the user can create, edit, or delete an event. 30 */ 31 $can_crud_event = apply_filters( 'gp_translation_events_can_crud_event', GP::$permission->current_user_can( 'admin' ) ); 32 if ( $can_crud_event ) : 33 ?> 34 <li><a class="button is-primary" href="<?php echo esc_url( gp_url( '/events/new/' ) ); ?>">Create Event</a></li> 25 <?php if ( current_user_can( 'manage_translation_events' ) ) : ?> 26 <li><a href="<?php echo esc_url( Urls::events_trashed() ); ?>">Deleted Events</a></li> 27 <?php endif; ?> 28 <li><a href="<?php echo esc_url( Urls::my_events() ); ?>">My Events</a></li> 29 <?php if ( current_user_can( 'create_translation_event' ) ) : ?> 30 <li><a class="button is-primary" href="<?php echo esc_url( Urls::event_create() ); ?>">Create Event</a></li> 35 31 <?php endif; ?> 36 32 <?php endif; ?> 37 33 </ul> 38 <?php if ( isset( $event ) && ! isset( $event_form_name ) ) : ?>34 <?php if ( isset( $event ) && ! isset( $event_form_name ) && ! isset( $hide_sub_head ) ) : ?> 39 35 <p class="event-sub-head"> 40 36 <span class="event-host"> 41 37 <?php 42 if ( count( $hosts ) > 0 ) : 43 if ( 1 === count( $hosts ) ) : 44 esc_html_e( 'Host:', 'gp-translation-events' ); 38 if ( isset( $hosts ) ) : 39 if ( count( $hosts ) > 0 ) : 40 if ( 1 === count( $hosts ) ) : 41 esc_html_e( 'Host:', 'gp-translation-events' ); 42 else : 43 esc_html_e( 'Hosts:', 'gp-translation-events' ); 44 endif; 45 45 else : 46 esc_html_e( 'Hosts:', 'gp-translation-events' ); 46 esc_html_e( 'Created by:', 'gp-translation-events' ); 47 ?> 48 <a href="<?php echo esc_attr( get_author_posts_url( $user->ID ) ); ?>"><?php echo esc_html( get_the_author_meta( 'display_name', $user->ID ) ); ?></a> 49 <?php 47 50 endif; 48 else :49 esc_html_e( 'Created by:', 'gp-translation-events' );50 51 ?> 51 <a href="<?php echo esc_attr( get_author_posts_url( $user->ID ) ); ?>"><?php echo esc_html( get_the_author_meta( 'display_name', $user->ID ) ); ?></a> 52 <?php 53 endif; 54 ?> 55 <?php foreach ( $hosts as $host ) : ?> 56 <a href="<?php echo esc_attr( get_author_posts_url( $host->user_id() ) ); ?>"><?php echo esc_html( get_the_author_meta( 'display_name', $host->user_id() ) ); ?></a> 57 <?php if ( end( $hosts ) !== $host ) : ?> 58 , 59 <?php else : ?> 60 . 61 <?php endif; ?> 62 <?php endforeach; ?> 52 <?php foreach ( $hosts as $host ) : ?> 53 <a href="<?php echo esc_attr( get_author_posts_url( $host->user_id() ) ); ?>"><?php echo esc_html( get_the_author_meta( 'display_name', $host->user_id() ) ); ?></a> 54 <?php if ( end( $hosts ) !== $host ) : ?> 55 , 56 <?php else : ?> 57 . 58 <?php endif; ?> 59 <?php endforeach; ?> 60 <?php endif; ?> 63 61 </span> 64 <?php $show_edit_button = ( ( $attendee instanceof Attendee && $attendee->is_host() ) || current_user_can( 'edit_post', $event->id() ) ) && $is_editable_event; ?> 65 <?php if ( $show_edit_button ) : ?> 66 <a class="event-page-edit-link" href="<?php echo esc_url( gp_url( 'events/edit/' . $event->id() ) ); ?>"><span class="dashicons dashicons-edit"></span><?php esc_html_e( 'Edit event', 'gp-translation-events' ); ?></a> 62 <?php if ( current_user_can( 'edit_translation_event', $event->id() ) ) : ?> 63 <a class="event-page-edit-link" href="<?php echo esc_url( Urls::event_edit( $event->id() ) ); ?>"><span class="dashicons dashicons-edit"></span><?php esc_html_e( 'Edit event', 'gp-translation-events' ); ?></a> 64 <?php elseif ( current_user_can( 'edit_translation_event_attendees', $event->id() ) ) : ?> 65 <a class="event-page-attendees-link" href="<?php echo esc_url( Urls::event_attendees( $event->id() ) ); ?>"><?php esc_html_e( 'Manage attendees', 'gp-translation-events' ); ?></a> 67 66 <?php endif ?> 68 67 </p>
Note: See TracChangeset
for help on using the changeset viewer.