Skip to content

Commit

Permalink
Remove unneeded checks
Browse files Browse the repository at this point in the history
We already checke it above, and the start of the attendees section.
  • Loading branch information
psrpinto committed Apr 18, 2024
1 parent 4c8de23 commit 2246235
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions templates/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,15 @@
<span class="first-time-contributor-tada" title="<?php esc_html_e( 'New Translation Contributor', 'gp-translation-events' ); ?>"></span>
<?php endif; ?>
<?php
if ( ! $event->end()->is_in_the_past() ) :
if ( ( $attendee instanceof Attendee && $attendee->is_host() ) || current_user_can( 'manage_options' ) || $user->ID === $event->author_id() ) :
$_attendee = $attendee_repo->get_attendee( $event_id, $_user->ID );
if ( $_attendee instanceof Attendee ) :
echo '<form class="add-remove-user-as-host" method="post" action="' . esc_url( gp_url( "/events/host/$event_id/$_user->ID" ) ) . '">';
if ( $_attendee->is_host() ) :
echo '<input type="submit" class="button is-primary remove-as-host" value="Remove as host"/>';
else :
echo '<input type="submit" class="button is-secondary convert-to-host" value="Make co-host"/>';
endif;
echo '</form>';
endif;
$_attendee = $attendee_repo->get_attendee( $event_id, $_user->ID );
if ( $_attendee instanceof Attendee ) :
echo '<form class="add-remove-user-as-host" method="post" action="' . esc_url( gp_url( "/events/host/$event_id/$_user->ID" ) ) . '">';
if ( $_attendee->is_host() ) :
echo '<input type="submit" class="button is-primary remove-as-host" value="Remove as host"/>';
else :
echo '<input type="submit" class="button is-secondary convert-to-host" value="Make co-host"/>';
endif;
echo '</form>';
endif;
?>
</li>
Expand Down

0 comments on commit 2246235

Please sign in to comment.