Forum Replies Created

Viewing 15 replies - 1 through 15 (of 69 total)
  • Thread Starter GideonLupine

    (@gideonlupine)

    I am looking for a simple answer of, “The Events Calendar guys say that when you have an online only event, you do steps X, Y, and Z. Do that, and everyone will be happy and I can leave early.”

    Thread Starter GideonLupine

    (@gideonlupine)

    I got everything solved. Debugging is covered.

    None of our custom code touches anything related to events.

    The trouble seems to be events that are online only.

    I just don’t know how to best handle an event that is “online”?

    Staff don’t know how to handle “online” events like a webinar or presentation that does not have an actual street address on Google Maps. I see them doing weird stuff and different people are doing their own thing. So what should I tell them is the official right answer?

    Do we create a venue that is just a link without an address or something?

    Do I create a event that simply does not have a venue?

    The latter would be odd because it would make consistency harder.

    Not knowing anything about anything, it seems to me there could be many ways to skin this cat. What is the best way that you guys recommend to deal with online only events?

    You guys said that creating a venue without an address is bad. Well, users are doing that because they don’t know better. What should I tell them to do when they have an online event?

    • This reply was modified 3 months, 2 weeks ago by GideonLupine.
    Thread Starter GideonLupine

    (@gideonlupine)

    OK, so can I get an answer on how to best handle an event that is “online”?

    The problem seems to exist because staff don’t know how to handle “online” events like a webinar or presentation that does not have an actual street address on Google Maps.

    Do I create a venue that is just a link without an address or something?

    Do I create a event that simply does not have a venue?

    The latter would be odd because it would make consistency harder.

    Not knowing anything about anything, it seems to me there could be many ways to skin this cat. What is the best way that you guys recommend?

    Thread Starter GideonLupine

    (@gideonlupine)

    Your plugin needs to have venue.php updated.

    You need to add basic error checking and just not assume everything is rosy all the time.

    I made some assumptions, but your programmer should be able to adapt quickly. I commented my changes, and left the rest of the code intact.

    I added three basic checks:

    • Check for $event->venues existence and type being an object
    • Add check for $venue = $event->venues[0] being an object
    • Add default empty strings for undefined properties

    The code fails on the second check, but not the first. Why is that? What is staff who are regular users who don’t know how to work anything doing wrong to cause this? So I can stop whatever they are doing.

    <?php

    /**

     * View: List Single Event Venue

     *

     * Override this template in your own theme by creating a file at:

     * [your-theme]/tribe/events/v2/list/event/venue.php

     *

     * See more documentation about our views templating system.

     *

     * @link https://evnt.is/1aiy

     *

     * @version 6.2.0

     * @since 6.2.0 Added the
    tec_events_view_venue_after_address action.

     *

     * @var WP_Post $event The event post object with properties added by the tribe_get_event function.

     * @var string  $slug  The slug of the view.

     *

     * @see tribe_get_event() For the format of the event object.

     */

    // FIX: Check for $event->venues existence and type

    if (!isset($event->venues)) {

      error_log('Event Venue Error: $event->venues is not set for event ID: ' . (isset($event->ID) ? $event->ID : 'unknown'));

      return;

    } elseif (!is_object($event->venues)) {

      error_log('Event Venue Error: $event->venues is not an object for event ID: ' .

        (isset($event->ID) ? $event->ID : 'unknown') .

        '. Actual type: ' . gettype($event->venues) .

        '. Value: ' . var_export($event->venues, true));

      return;

    }

    // FIX: END

    if (! $event->venues->count()) {

      return;

    }

    $separator            = esc_html_x(', ', 'Address separator', 'the-events-calendar');

    $venue                = $event->venues[0];

    // FIX: Add check for $venue = $event->venues[0] being an object

    if (! is_object($venue)) {

      error_log('Event Venue Error: $venue=$event->venues[0] is not an object for event ID: ' .

        (isset($event->ID) ? $event->ID : 'unknown') .

        '. Actual type: ' . gettype($venue) .

        '. Value: ' . var_export($venue, true));

      return;

    }

    // FIX: END

    // FIX: Add default empty strings for undefined properties

    $append_after_address = array_filter(array_map('trim', [

      $venue->state_province ?? '',

      $venue->state ?? '',

      $venue->province ?? ''

    ]));

    // FIX: END

    // FIX: Add default empty strings for undefined properties

    $address = ($venue->address ?? '') . (($venue->address ?? '') && ($append_after_address || isset($venue->city)) ? $separator : '');

    // FIX: END

    ?>

    <address class="tribe-events-calendar-list__event-venue tribe-common-b2">

      <span class="tribe-events-calendar-list__event-venue-title tribe-common-b2--bold">

        <?php

        // FIX: Add default empty strings for undefined properties

        echo wp_kses_post($venue->post_title ?? '');

        // FIX: END

        ?>

      </span>

      <span class="tribe-events-calendar-list__event-venue-address">

        <?php

        echo esc_html($address);

        if (! empty($venue->city)) :

          echo esc_html($venue->city);

          if ($append_after_address) :

            echo $separator;

          endif;

        endif;

        if ($append_after_address) :

          echo esc_html(reset($append_after_address));

        endif;

        if (! empty($venue->country)):

          echo $separator . esc_html($venue->country);

        endif;

        ?>

      </span>

      <?php

      /**

       * Fires after the full venue has been displayed.

       *

       * @since 6.2.0

       *

       * @param WP_Post $event Event post object.

       * @param string  $slug  Slug of the view.

       */

      do_action('tec_events_view_venue_after_address', $event, $slug);

      ?>

    </address><?php

    /**

     * View: List Single Event Venue

     *

     * Override this template in your own theme by creating a file at:

     * [your-theme]/tribe/events/v2/list/event/venue.php

     *

     * See more documentation about our views templating system.

     *

     * @link https://evnt.is/1aiy

     *

     * @version 6.2.0

     * @since 6.2.0 Added the tec_events_view_venue_after_address action.

     *

     * @var WP_Post $event The event post object with properties added by the tribe_get_event function.

     * @var string  $slug  The slug of the view.

     *

     * @see tribe_get_event() For the format of the event object.

     */

    // FIX: Check for $event->venues existence and type

    if (!isset($event->venues)) {

      error_log('Event Venue Error: $event->venues is not set for event ID: ' . (isset($event->ID) ? $event->ID : 'unknown'));

      return;

    } elseif (!is_object($event->venues)) {

      error_log('Event Venue Error: $event->venues is not an object for event ID: ' .

        (isset($event->ID) ? $event->ID : 'unknown') .

        '. Actual type: ' . gettype($event->venues) .

        '. Value: ' . var_export($event->venues, true));

      return;

    }

    // FIX: END

    if (! $event->venues->count()) {

      return;

    }

    $separator            = esc_html_x(', ', 'Address separator', 'the-events-calendar');

    $venue                = $event->venues[0];

    // FIX: Add check for $venue = $event->venues[0] being an object

    if (!is_object($venue)) {

      error_log('Event Venue Error: $venue=$event->venues[0] is not an object for event ID: ' .

        (isset($event->ID) ? $event->ID : 'unknown') .

        '. Actual type: ' . gettype($venue) .

        '. Value: ' . var_export($venue, true));

      return;

    }

    // FIX: END

    // FIX: Add default empty strings for undefined properties

    $append_after_address = array_filter(array_map('trim', [

      $venue->state_province ?? '',

      $venue->state ?? '',

      $venue->province ?? ''

    ]));

    // FIX: END

    // FIX: Add default empty strings for undefined properties

    $address = ($venue->address ?? '') . (($venue->address ?? '') && ($append_after_address || isset($venue->city)) ? $separator : '');

    // FIX: END

    ?>

    <address class="tribe-events-calendar-list__event-venue tribe-common-b2">

      <span class="tribe-events-calendar-list__event-venue-title tribe-common-b2--bold">

        <?php

        // FIX: Add default empty strings for undefined properties

        echo wp_kses_post($venue->post_title ?? '');

        // FIX: END

        ?>

      </span>

      <span class="tribe-events-calendar-list__event-venue-address">

        <?php

        echo esc_html($address);

        if (! empty($venue->city)) :

          echo esc_html($venue->city);

          if ($append_after_address) :

            echo $separator;

          endif;

        endif;

        if ($append_after_address) :

          echo esc_html(reset($append_after_address));

        endif;

        if (! empty($venue->country)):

          echo $separator . esc_html($venue->country);

        endif;

        ?>

      </span>

      <?php

      /**

       * Fires after the full venue has been displayed.

       *

       * @since 6.2.0

       *

       * @param WP_Post $event Event post object.

       * @param string  $slug  Slug of the view.

       */

      do_action('tec_events_view_venue_after_address', $event, $slug);

      ?>

    </address>
    • This reply was modified 3 months, 2 weeks ago by GideonLupine.
    Thread Starter GideonLupine

    (@gideonlupine)

    I am the admin, so I don’t use The Events Calendar directly.

    Apparently, the staff are complete idiots.

    What is the best practice for an event that is “Online?” The location is a website or online meeting tool, not an actual map address.

    I don’t think they read or understand your manual. Whatever they think they are doing is obviously wrong.

    I understand their intent, I just don’t know what is the best way to do it.

    I do know they keep changing their webinar or meeting app like changing underwear, so I need a generic best practice.

    Thread Starter GideonLupine

    (@gideonlupine)

    I found a venue called “Online”, but it has no values. Just the title.

    What would I do in that situation?

    Thread Starter GideonLupine

    (@gideonlupine)

    I am getting these errors:

    [13-Aug-2024 07:56:27 UTC] Event Venue Error: Venue is not an object for event ID: 6569. Actual type: integer. Value: 5633

    [13-Aug-2024 07:56:27 UTC] Event Venue Error: Venue is not an object for event ID: 6569. Actual type: integer. Value: 5633

    [13-Aug-2024 08:04:28 UTC] Event Venue Error: Venue is not an object for event ID: 6569. Actual type: integer. Value: 5633

    [13-Aug-2024 08:04:28 UTC] Event Venue Error: Venue is not an object for event ID: 6569. Actual type: integer. Value: 5633

    [13-Aug-2024 08:45:25 UTC] Event Venue Error: Venue is not an object for event ID: 14225. Actual type: integer. Value: 7298

    [13-Aug-2024 08:45:25 UTC] Event Venue Error: Venue is not an object for event ID: 14261. Actual type: integer. Value: 7298

    [13-Aug-2024 08:45:25 UTC] Event Venue Error: Venue is not an object for event ID: 14350. Actual type: integer. Value: 7298

    Thread Starter GideonLupine

    (@gideonlupine)

    Added one more default empty string value:

    <?php

    /**

    ?* View: List Single Event Venue

    ?*

    ?* Override this template in your own theme by creating a file at:

    ?* [your-theme]/tribe/events/v2/list/event/venue.php

    ?*

    ?* See more documentation about our views templating system.

    ?*

    ?* @link https://evnt.is/1aiy

    ?*

    ?* @version 6.2.0

    ?* @since 6.2.0 Added the
    tec_events_view_venue_after_address action.

    ?*

    ?* @var WP_Post $event The event post object with properties added by the tribe_get_event function.

    ?* @var string ?$slug ?The slug of the view.

    ?*

    ?* @see tribe_get_event() For the format of the event object.

    ?*/

    // FIX: Check for $event->venues existence and type

    if (!isset($event->venues)) {

    ? error_log('Event Venue Error: $event->venues is not set for event ID: ' . (isset($event->ID) ? $event->ID : 'unknown'));

    ? return;

    } elseif (!is_object($event->venues)) {

    ? error_log('Event Venue Error: $event->venues is not an object for event ID: ' .

    ? ? (isset($event->ID) ? $event->ID : 'unknown') .

    ? ? '. Actual type: ' . gettype($event->venues) .

    ? ? '. Value: ' . var_export($event->venues, true));

    ? return;

    }

    // FIX: END

    if (! $event->venues->count()) {

    ? return;

    }

    $separator ? ? ? ? ? ?= esc_html_x(', ', 'Address separator', 'the-events-calendar');

    $venue ? ? ? ? ? ? ? ?= $event->venues[0];

    // FIX: Add check for $venue being an object

    if (! is_object($venue)) {

    ? error_log('Event Venue Error: Venue is not an object for event ID: ' .

    ? ? (isset($event->ID) ? $event->ID : 'unknown') .

    ? ? '. Actual type: ' . gettype($venue) .

    ? ? '. Value: ' . var_export($venue, true));

    ? return;

    }

    // FIX: END

    // FIX: Add default empty strings

    $append_after_address = array_filter(array_map('trim', [

    ? $venue->state_province ?? '',

    ? $venue->state ?? '',

    ? $venue->province ?? ''

    ]));

    // FIX: END

    // FIX: Add default empty strings

    $address = ($venue->address ?? '') . (($venue->address ?? '') && ($append_after_address || isset($venue->city)) ? $separator : '');

    // FIX: END

    ?>

    <address class="tribe-events-calendar-list__event-venue tribe-common-b2">

    ? <span class="tribe-events-calendar-list__event-venue-title tribe-common-b2--bold">

    ? ? <?php

    ? ? //FIX: Add default empty strings

    ? ? echo wp_kses_post($venue->post_title ?? '');

    ? ? //FIX: END

    ? ? ?>

    ? </span>

    ? <span class="tribe-events-calendar-list__event-venue-address">

    ? ? <?php

    ? ? echo esc_html($address);

    ? ? if (! empty($venue->city)) :

    ? ? ? echo esc_html($venue->city);

    ? ? ? if ($append_after_address) :

    ? ? ? ? echo $separator;

    ? ? ? endif;

    ? ? endif;

    ? ? if ($append_after_address) :

    ? ? ? echo esc_html(reset($append_after_address));

    ? ? endif;

    ? ? if (! empty($venue->country)):

    ? ? ? echo $separator . esc_html($venue->country);

    ? ? endif;

    ? ? ?>

    ? </span>

    ? <?php

    ? /**

    ? ?* Fires after the full venue has been displayed.

    ? ?*

    ? ?* @since 6.2.0

    ? ?*

    ? ?* @param WP_Post $event Event post object.

    ? ?* @param string ?$slug ?Slug of the view.

    ? ?*/

    ? do_action('tec_events_view_venue_after_address', $event, $slug);

    ? ?>

    </address>
    Thread Starter GideonLupine

    (@gideonlupine)

    My logs now have:

    [13-Aug-2024 07:03:24 UTC] Event Venue Error: Venue is not an object for event ID: 6569. Actual type: integer. Value: 5633

    Thread Starter GideonLupine

    (@gideonlupine)

    Its an object not an array, so I tried this:

    <?php

    /**

    ?* View: List Single Event Venue

    ?*

    ?* Override this template in your own theme by creating a file at:

    ?* [your-theme]/tribe/events/v2/list/event/venue.php

    ?*

    ?* See more documentation about our views templating system.

    ?*

    ?* @link https://evnt.is/1aiy

    ?*

    ?* @version 6.2.0

    ?* @since 6.2.0 Added the
    tec_events_view_venue_after_address action.

    ?*

    ?* @var WP_Post $event The event post object with properties added by the tribe_get_event function.

    ?* @var string ?$slug ?The slug of the view.

    ?*

    ?* @see tribe_get_event() For the format of the event object.

    ?*/

    // FIX: Check for $event->venues existence and type

    if (!isset($event->venues)) {

    ? error_log('Event Venue Error: $event->venues is not set for event ID: ' . (isset($event->ID) ? $event->ID : 'unknown'));

    ? return;

    } elseif (!is_object($event->venues)) {

    ? error_log('Event Venue Error: $event->venues is not an object for event ID: ' .

    ? ? (isset($event->ID) ? $event->ID : 'unknown') .

    ? ? '. Actual type: ' . gettype($event->venues) .

    ? ? '. Value: ' . var_export($event->venues, true));

    ? return;

    }

    // FIX: END

    if (! $event->venues->count()) {

    ? return;

    }

    $separator ? ? ? ? ? ?= esc_html_x(', ', 'Address separator', 'the-events-calendar');

    $venue ? ? ? ? ? ? ? ?= $event->venues[0];

    // FIX: Add check for $venue being an object

    if (! is_object($venue)) {

    ? error_log('Event Venue Error: Venue is not an object for event ID: ' .

    ? ? (isset($event->ID) ? $event->ID : 'unknown') .

    ? ? '. Actual type: ' . gettype($venue) .

    ? ? '. Value: ' . var_export($venue, true));

    ? return;

    }

    // FIX: END

    // FIX: Add default empty strings for potentially undefined properties

    $append_after_address = array_filter(array_map('trim', [

    ? $venue->state_province ?? '',

    ? $venue->state ?? '',

    ? $venue->province ?? ''

    ]));

    // FIX: END

    // FIX: Add default empty strings for potentially undefined properties

    $address = ($venue->address ?? '') . (($venue->address ?? '') && ($append_after_address || isset($venue->city)) ? $separator : '');

    // FIX: END

    ?>
    Thread Starter GideonLupine

    (@gideonlupine)

    I changed line 22 to this:

    // FIX: Checks for event venue data integrity

    if (! isset($event->venues)) {

    ? error_log('Event Venue Error: $event->venues is not set for event ID: ' . (isset($event->ID) ? $event->ID : 'unknown'));

    ? return;

    }

    if (! is_array($event->venues)) {

    ? error_log('Event Venue Error: $event->venues is not an array for event ID: ' . (isset($event->ID) ? $event->ID : 'unknown') . '. Type: ' . gettype($event->venues));

    ? return;

    }

    if (empty($event->venues)) {

    ? error_log('Event Venue Error: $event->venues is empty for event ID: ' . (isset($event->ID) ? $event->ID : 'unknown'));

    ? return;

    }

    // FIX: END

    I am now getting in the log:

    [13-Aug-2024 06:20:32 UTC] Event Venue Error: $event->venues is not an array for event ID: 6305. Type: object

    [13-Aug-2024 06:20:35 UTC] Event Venue Error: $event->venues is not an array for event ID: 6363. Type: object

    [13-Aug-2024 06:20:35 UTC] Event Venue Error: $event->venues is not an array for event ID: 6357. Type: object

    [13-Aug-2024 06:20:35 UTC] Event Venue Error: $event->venues is not an array for event ID: 6347. Type: object

    [13-Aug-2024 06:20:35 UTC] Event Venue Error: $event->venues is not an array for event ID: 6343. Type: object

    [13-Aug-2024 06:20:35 UTC] Event Venue Error: $event->venues is not an array for event ID: 6333. Type: object

    [13-Aug-2024 06:20:35 UTC] Event Venue Error: $event->venues is not an array for event ID: 6331. Type: object

    [13-Aug-2024 06:20:35 UTC] Event Venue Error: $event->venues is not an array for event ID: 6325. Type: object

    [13-Aug-2024 06:20:35 UTC] Event Venue Error: $event->venues is not an array for event ID: 6323. Type: object

    [13-Aug-2024 06:20:35 UTC] Event Venue Error: $event->venues is not an array for event ID: 6314. Type: object

    [13-Aug-2024 06:20:35 UTC] Event Venue Error: $event->venues is not an array for event ID: 6305. Type: object
    Thread Starter GideonLupine

    (@gideonlupine)

    I added this:

    // FIX: Set default strings if not found.
    $append_after_address = array_filter(array_map('trim', [
    isset($venue->state_province) ? $venue->state_province : '',
    isset($venue->state) ? $venue->state : '',
    isset($venue->province) ? $venue->province : ''
    ]));
    // FIX: END

    Thread Starter GideonLupine

    (@gideonlupine)

    In your venue.php, I see one issue right off.

    Line 22:

    if (! $event->venues->count()) {

    I am changing to:

    if (! isset($event->venues) || ! is_array($event->venues) || ! $event->venues) {

    I am also returning if:

    if (! is_object($venue)) {

    Thread Starter GideonLupine

    (@gideonlupine)

    In wp_posts, I have 1,303 posts of type tribe_events.

    Meta values for them begin with _Event in wp_postmeta.

    For _EventVenueID, I only found 396.

    All _EventVenueID have values that appear to be numbers.

    For post_type tribe_venue, I found 293.

    Meta values for them begin with _Venue.

    The more I look at this, this seems silly. I am going to look at your venue.php file, and see if I can put some error checking in it.

    Thread Starter GideonLupine

    (@gideonlupine)

    I am trying to figure out what events or venues have the offending value.

    I am not aware of any changes. I don’t think it is old events, because they are old, and we had no issues in the past.

    New events, look normal. Most have no venue.

    Maybe an old venue that was fine, got messed up somehow? Maybe even deleted?

    I am the admin, and know zip about your Event Plugin. I have a vague idea.

    Can you give me a clue of where to look in phpMyAdmin? I can search for things much easier there, and “see” values better.

    Just need to know where to look.

    This thing is making a mess, and it started fairly recently.

Viewing 15 replies - 1 through 15 (of 69 total)