Support

Account

Home Forums General Issues Showdown content if current user.. Reply To: Showdown content if current user..

  • Filename single-day.php

    <?php
    /**
     * Month View Single Day
     * This file contains one day in the month grid
     *
     * Override this template in your own theme by creating a file at [your-theme]/tribe-events/month/single-day.php
     *
     * @package TribeEventsCalendar
     *
     */
    
    if ( !defined('ABSPATH') ) { die('-1'); } ?>
    
    <?php
    $day = tribe_events_get_current_month_day();
    ?>
    
    <?php if ( $day['date'] != 'previous' && $day['date'] != 'next' ) : ?>
    
    	<!-- Day Header demon controller 2 -->
    	<div id="tribe-events-daynum-<?php echo $day['daynum'] ?>">
    
    		<?php if ( $day['total_events'] > 0 && tribe_events_is_view_enabled( 'day' ) ) { ?>
    			<a href="<?php echo tribe_get_day_link( $day['date'] ) ?>"><?php echo $day['daynum'] ?></a>
    		<?php } else { ?>
    			<?php echo $day['daynum'] ?>
    		<?php } ?>
    
    	</div>
    
    	<!-- EDITED - show this part only if the user must join Events List -->
    
    <?php $current_user = wp_get_current_user(); ?>
    <?php global $user_login;
          get_currentuserinfo(); ?>
    <?php $lookforuser = get_field('mustjoin'); var_dump($lookforuser);var_dump(strpos($lookforuser, $user_login)); ?>
    <?php echo 'event exists<br/>';tribe_get_template_part('month/single', 'event') ?>
    <?php if (strpos($lookforuser, $user_login) !== false) { ?>
        <?php while ($day['events']->have_posts()) : $day['events']->the_post() ?>
        <?php tribe_get_template_part('month/single', 'event') ?>
        <?php endwhile; ?>
    <?php } ?>
    
    	<!-- View More -->
    	<?php if ( $day['view_more'] && tribe_events_is_view_enabled( 'day' ) ) : ?>
    		<div class="tribe-events-viewmore">
    			<?php
    				if($day['total_events'] > 1 || $day['total_events'] == 0) {
    					$events_label = __( 'Events ', 'tribe-events-calendar' );
    				} else {
    					$events_label = __( 'Event ', 'tribe-events-calendar' );
    				}
    			?>
    			<a href="<?php echo $day['view_more'] ?>">View All <?php echo $day['total_events'] . " " . $events_label ?> &raquo;</a>
    		</div>
    	<?php endif ?>
    
    <?php endif; ?>