Exemplo n.º 1
0
}
global $post;
/**
 * We build and gather information specific to the individual event prior to
 * the tribe_events_template_data() call to reduce the opportunities for 3rd
 * party code to call wp_reset_postdata() or similar, which can result in the
 * $post global referencing something other than the event we're interested
 * in.
 */
$users_events = new ES_DB_UsersEvents();
$day = tribe_events_get_current_month_day();
$event_id = "{$post->ID}-{$day['daynum']}";
$link = tribe_get_event_link($post);
$title = get_the_title($post);
$users = es_event_find_users($post);
$spots = es_event_get_spots($post);
$onlist_count = count($users_events->get_users($post, "onlist"));
$users_count = count($users);
/**
 * How to Use the Javascript Templating System in this View
 * ========================================================
 *
 * Month view (and week in events pro) has implemented javascript templating to power its rich tooltips and mobile views
 * as of Events Version 3.3. This is a guide on how to modify, extend and use this functionality.
 *
 * 1) Overview
 *
 * As of version 3.3 our tooltips and mobile views use a custom javascript templating solution.
 *
 * How it works: event data for each event - such as title, start and end time, excerpt etc - is stored on a data
 * attribute tagged "data-tribejson" in the markup. This particular json works with simple single level key value pairs.
Exemplo n.º 2
0
 *
 * Override this template in your own theme by creating a file at [your-theme]/tribe-events/single-event.php
 *
 * @package TribeEventsCalendar
 *
 */
if (!defined('ABSPATH')) {
    die('-1');
}
$event = get_post();
$current_user = wp_get_current_user();
$users_events = new ES_DB_UsersEvents();
$users = $users_events->get_users($event, "onboard");
$users_count = count($users);
$onlist_count = count($users_events->get_users($event, "onlist"));
$spots = es_event_get_spots($event);
$spots_left = $spots - $users_count;
$onlist_left = 1 - $onlist_count;
// Make sure $onlist_left is not negative
$onlist_left = $onlist_left < 0 ? 0 : $onlist_left;
$participating = $users_events->user_status($current_user, $event) == "onboard";
if (isset($_POST['subscribe']) || isset($_GET['subscribe'])) {
    if (isset($_GET['subscribe'])) {
        $event = get_post($_GET['event_id']);
    } else {
        $event = get_post($_POST['event_id']);
    }
    $is_subscribed = $users_events->user_subscribed($current_user, $event);
    if (!$is_subscribed) {
        $response = $users_events->add($current_user, $event);
        if ($response === true) {