phylaxis

Forum Replies Created

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • in reply to: "All" view in Events not populating for Author Role #1635449
    phylaxis
    Participant

    Thanks. Yes. You have the bug 100% correct. We don’t need users to be able to edit them, as they would not have permissions, but they are expecting to be able to see them and that is not happening. It’s causing some confusion.

    phylaxis
    Participant

    Ok. Thanks for the reply. I ended up implementing in a different way that worked for my situation. I’m posting my solution in case others find it helpful.

    I set up a flag on the tribe events custom post type using Advanced Custom Fields Pro and exposed that setting in the Event admin with ACF. I look for that flag and adjust the behavior in the calendar view template. I do this with an override in the tribe-events/month/single-event.php template in my custom theme.

    Here is the relevant code in case it might help someone else:

    At the top of the file I check for the ACF value and adjust the link variable accordingly:

    
    //see if we should link to the event website
    $link_to_event_website = get_post_meta( $post->ID, 'bdc-calendar-event-url', true );
    $event_website_url = tribe_get_event_meta( $post->ID, '_EventURL', true );
    if( $event_website_url &&  $link_to_event_website )
    {
    	$link = $event_website_url;
    }
    

    Later in the page this data is used to create the link.
    Please note in this example I’m also passing the some additional data that I built up earlier into the data-tribejson attribute to be used by the Javascript Templating System, but that’s not relevant to this example.

    
    //add additional data for pop-up
    $additional_data  = array(
       'eventCost'       => ltrim($event_cost, '$'),
       'eventStart'      => $event_start,
       'eventEnd'        => $event_end,
       'eventLocation'   => $event_location
    );
    ?>
    <div id="tribe-events-event-<?php echo esc_attr( $event_id ); ?>"<?php echo ( $event_style ); ?>class="<?php tribe_events_event_classes() ?>"  data-tribejson='<?php echo esc_attr( tribe_events_template_data( $post, $additional_data ) ); ?>'>
    	<h3 class="tribe-events-month-event-title"><a href="<?php echo esc_url( $link ) ?>" class="url"><?php echo $title ?></a></h3>
    </div><!-- #tribe-events-event-# -->
    
    in reply to: Disabling Editing of Event Categories #1635415
    phylaxis
    Participant

    This reply is private.

    in reply to: 'Today' link clears Filter Bar Filters #1569663
    phylaxis
    Participant

    Sorry, yes. That’s clear. I guess I was asking, is there another “official” way to accomplish this functionality that I missed in the documentation? One that would better support the Filterbar.

    in reply to: 'Today' link clears Filter Bar Filters #1569606
    phylaxis
    Participant

    So just to confirm/clarify @cliff, it is default behavior for the “today” link to clear/reset the Filterbar filters when installed with Events Calendar Pro? I was hoping that using the “today” link would be smart enough to know that filters are applied (like the previous and next month buttons).

    in reply to: Filter Bar not working with Calendar Month Grid AJAX #1567278
    phylaxis
    Participant

    Hey Jamie it’s been a few weeks and I have a client project that is waiting on this fix to be able to be launched. Is there any status update on this? I assume they verified the issue? It seems like a pretty critical one since basically the filter product doesn’t work as expected.

    in reply to: Filter Bar not working with Calendar Month Grid AJAX #1555542
    phylaxis
    Participant

    Thanks Jamie. To reproduce the issue you can do the following:

    1) Go to: http://avalon.dance/events/month/

    2) Select the ‘The Avalon Ballroom’ under ‘Location’

    3) You’ll see the AJAX spinner load, but the items on the calendar do not get filtered, but the URL will update.

    4) Click the refresh/reload button in your browser. Now the calendar will be filtered.

    in reply to: Mini Calendar by Organizer? #1470363
    phylaxis
    Participant

    Thanks @jaime. I actually have the developer skills to build my own solution for this, but I didn’t want to go that route if there was already a solution in place. This information is helpful. I’ll start writing my own plug-in for what I need.

    in reply to: Mini Calendar by Organizer? #1468773
    phylaxis
    Participant

    Yeah, that’s not exactly what I need. I basically need the data that would be displayed in the event list, but in the mini calendar view. Is there not a way to do that?

    in reply to: Mini Calendar by Organizer #1467775
    phylaxis
    Participant

    Sorry i posted this to the wrong section by mistake.

    phylaxis
    Participant

    Oh, here is the final full function I used in case anyone finds it helpful:

    function sdgc_get_events($start=null,$end=null) {
    global $post;
    // set the time to local
    $timezone = get_option( 'timezone_string' );
    date_default_timezone_set($timezone);
    $start_date = isset($start) ? date('Y-m-d 00:00:00', $start) : date('Y-m-d 00:00:00', strtotime('-1 day'));
    $end_date = isset($end) ? date('Y-m-d 23:59:59', $end) : date('Y-m-d 23:59:59', strtotime('+6 day'));
    $get_posts = tribe_get_events(array('start_date'=>$start_date,'end_date'=>$end_date, 'posts_per_page'=>10, 'eventDisplay'=>'all' ) );

    printf('<table class="sdgc-events">');
    printf('<tbody>');
    foreach($get_posts as $post) {
    setup_postdata($post);
    $dt = tribe_get_start_date($post->ID, true, 'j M Y');
    $cd = new DateTime($dt);
    $ft = $cd->format('n/j');
    if((strtotime($dt) > strtotime($cd)) && (strtotime($dt) < strtotime($end_date)))
    {
    printf('<tr><td class="sdgc-event-item"><span class="primary-color-light">%s</span> - <span class="sdgc-event-title">%s</span></td><td class="sdgc-chevron"><i class="fa fa-lg fa-chevron-circle-right"></i></td></tr>', get_permalink(), $ft, get_the_title(), get_permalink());
    }
    } //endforeach

    printf('</tbody>');
    printf('</table>');

    wp_reset_query();
    }

    Then call the function like this:
    <?php sdgc_get_events( strtotime("+1 day"), strtotime("+3 day") ); ?>

    phylaxis
    Participant

    Casey,
    Thanks for the reply. I actually did finally end up getting it working the way I needed it. there were two things that were key that I’ll mention here in case others run into some of the same trouble.

    First, since I’m on a shared server and don’t have much control over the PHP config I needed to compensate for time zone. Luckily it’s easy to do reading the WordPress setting and setting the default timezone in my function:

    // set the time to local
    $timezone = get_option( 'timezone_string' );
    date_default_timezone_set($timezone);

    Second, I needed to set the 'eventDisplay' argument to ‘all’ so that I could get each full days list of events, even if the event had passed for that day:

    $get_posts = tribe_get_events(array('start_date'=>$start_date,'end_date'=>$end_date, 'posts_per_page'=>10, 'eventDisplay'=>'all' ) );

    Finally, because I wanted to be sure I had a full day (and I’m not 100% sure this step is needed) I added a ’00:00:00′ time to my start dates and a ’23:59:59′ time end dates to ensure I was covering from the start of the day to the end of the day.

    $start_date = isset($start) ? date('Y-m-d 00:00:00', $start) : date('Y-m-d 00:00:00', strtotime('-1 day'));
    $end_date = isset($end) ? date('Y-m-d 23:59:59', $end) : date('Y-m-d 23:59:59', strtotime('+6 day'));

    After I made all those changes it now seems to be working as expected, including being able to use the 'posts_per_page'=>10 argument and get up to 10 events for each day in the correct range.

Viewing 12 posts - 1 through 12 (of 12 total)