Skip to content

Commit

Permalink
Remove the "Attend Event" if the event has passed. Add a bubble if th…
Browse files Browse the repository at this point in the history
…e user has assisted in a passed event. (#110)
  • Loading branch information
amieiro authored Feb 20, 2024
1 parent f13e355 commit 6af1b5d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion assets/css/translation-events.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ h2.event_page_title {
a.event-link-draft {
color:#80807f;
}
span.event-label-draft {
span.event-label-draft, span.event-details-join-expired {
font-weight: 500;
color:#c05621;
border: 1px solid #c05621;
Expand Down
21 changes: 15 additions & 6 deletions templates/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,22 @@
</div>
<?php if ( is_user_logged_in() ) : ?>
<div class="event-details-join">
<form class="event-details-attend" method="post" action="<?php echo esc_url( gp_url( "/events/attend/$event_id" ) ); ?>">
<?php if ( ! $user_is_attending ) : ?>
<input type="submit" class="button is-primary" value="Attend Event"/>
<?php else : ?>
<input type="submit" class="button is-secondary" value="You're attending"/>
<?php
$current_time = gmdate( 'Y-m-d H:i:s' );
if ( strtotime( $current_time ) > strtotime( $event_end ) ) :
?>
<?php if ( $user_is_attending ) : ?>
<span class="event-details-join-expired"><?php esc_html_e( 'You attended', 'gp-translation-events' ); ?></span>
<?php endif ?>
</form>
<?php else : ?>
<form class="event-details-attend" method="post" action="<?php echo esc_url( gp_url( "/events/attend/$event_id" ) ); ?>">
<?php if ( ! $user_is_attending ) : ?>
<input type="submit" class="button is-primary" value="Attend Event"/>
<?php else : ?>
<input type="submit" class="button is-secondary" value="You're attending"/>
<?php endif ?>
</form>
<?php endif ?>
</div>
<?php endif; ?>
</div>
Expand Down

0 comments on commit 6af1b5d

Please sign in to comment.