• Resolved hmpgit

    (@hmpgit)


    Downloaded and activated The Events Calendar Extension: Tweaks V1.1.1
    in order to show previous events in reverse order.

    After putting the tick in “Show past events in reverse order” in Tweaks section and saving the settings, this breaks the site and now all Events have disappeared.

    Have tested on a secondary install as well and the same thing happens.

    Checked the sites logs and get

    [Sat Sep 02 13:57:02 2023] [error] [client ] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, cannot access private method Tribe\Extensions\Tec_Tweaks\Main::tribe_past_reverse_chronological_v2() in /home/sites/public_html/wp-includes/class-wp-hook.php:312\nStack trace:\n#0 /home/sites//public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)\n#1 /home/sites/public_html/wp-content/plugins/the-events-calendar/src/Tribe/Views/V2/View.php(1314): apply_filters(‘tribe_events_vi…’, Array, Object(Tribe\Events\Views\V2\Views\List_View))\n#2 /home/sites/public_html/wp-content/plugins/the-events-calendar/src/Tribe/Views/V2/View.php(729): Tribe\Events\Views\V2\View->filter_template_vars(Array)\n#3 /home/sites/public_html/wp-content/plugins/the-events-calendar/src/Tribe/Views/V2/Template_Bootstrap.php(262): Tribe\Events\Views\V2\View->get_html()\n#4 /home/…’

    Running WordPress Core 6.3.1 and php8.0

    • This topic was modified 1 year, 2 months ago by hmpgit. Reason: Typo
    • This topic was modified 1 year, 2 months ago by hmpgit.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support tristan083

    (@tristan083)

    Hi @hmpgit ,

    Thank you for reaching out, and I’m sorry to learn of the difficulties.

    As an alternative, have you tried deactivating the extension plugin and applying the snippet in our Showing Past Events in Reverse Order knowledgebase article instead?

    Thread Starter hmpgit

    (@hmpgit)

    Doesn’t work. Have tried adding the code as per the link in the main functions file as well trying via a snipet plugin and neither work, the code does nothing to the display order. This is with the Tweaks plugin disabled. When the Tweaks plugin is re-enabled still get the below error and events disappear. Have tested on two different installs of WordPress and same issue.

    [Mon Sep 04 09:50:27 2023] [error] [client ] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, cannot access private method Tribe\Extensions\Tec_Tweaks\Main::tribe_past_reverse_chronological_v2() in /home/sites/10b/public_html/Test/wp-includes/class-wp-hook.php:312\nStack trace:\n#0 /home/sites/10b/public_html/Test/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)\n#1 /home/sites/10b/public_html/Test/wp-content/plugins/the-events-calendar/src/Tribe/Views/V2/View.php(1314): apply_filters(‘tribe_events_vi…’, Array, Object(Tribe\Events\Views\V2\Views\List_View))\n#2 /home/sites/10b/public_html/Test/wp-content/plugins/the-events-calendar/src/Tribe/Views/V2/View.php(729): Tribe\Events\Views\V2\View->filter_template_vars(Array)\n#3 /home/sites/10b/public_html/Test/wp-content/plugins/the-events-calendar/src/Tribe/Views/V2/Template_Bootstrap.php(262): Tribe\Events\Views\V2\View->get_html()\n#4 /home/…’

    Plugin Support Atousa Najafi

    (@atousanajafi)

    Hi @hmpgit,

    I tried the code, and it worked for the past events.

    Please make sure to follow this article for adding snippets to your site:

    https://theeventscalendar.com/knowledgebase/best-practices-for-implementing-custom-code-snippets/

    After adding the code, check the past events by entering the following URL in the address bar:

    https://YOUR SITE URL/events/list/?eventDisplay=past

    Best,

    Atousa

    Thread Starter hmpgit

    (@hmpgit)

    Sorry still not working

    Plugin Support Darian

    (@d0153)

    Hi @hmpgit

    I’m sorry to hear that you’re still having this issue. Could I ask for the version of The Events Calendar plugin that you’re using? I would like to check it further on my side.

    Thread Starter hmpgit

    (@hmpgit)

    6.2.1

    Plugin Support Darian

    (@d0153)

    Hi @hmpgit

    I was able to replicate the issue on my side when I enable the reverse order of past events from the Tweaks extension and enable the code snippet that reverses the order.

    When I only use the Tweaks extension, the issue persists. But deactivating the Tweaks extension and enabling the code snippets will reverse the order of past events as expected.

    Could you try to remove the snippet from the functions.php, install the Code Snippets plugin, add the following code below, and make sure to activate the snippet?

    /**
     * Changes Past Event Reverse Chronological Order
     *
     * @param array $template_vars An array of variables used to display the current view.
     *
     * @return array Same as above. 
     */
    function tribe_past_reverse_chronological_v2( $template_vars ) {
     
      if ( ! empty( $template_vars['is_past'] ) ) {
        $template_vars['events'] = array_reverse( $template_vars['events'] );
      }
     
      return $template_vars;
    }
    // Change List View to Past Event Reverse Chronological Order 
    add_filter( 'tribe_events_views_v2_view_list_template_vars', 'tribe_past_reverse_chronological_v2', 100 );
    // Change Photo View to Past Event Reverse Chronological Order
    add_filter( 'tribe_events_views_v2_view_photo_template_vars', 'tribe_past_reverse_chronological_v2', 100 );

    I implemented the above on my test site and it’s working as expected.

    I hope this helps, and please let me know if you have further questions or concerns.

    Thread Starter hmpgit

    (@hmpgit)

    Thanks for your reply, have tried the above and get error

    Snippet automatically deactivated due to an error on line 10:

    Syntax error, unexpected single-quoted string "is_past".

    Also tried the code from the page at https://theeventscalendar.com/knowledgebase/showing-past-events-in-reverse-order/ same issue.

    Plugin Support Darian

    (@d0153)

    Hi @hmpgit

    Could I ask for a screenshot of the page on how you’ve added your code snippet? I want to check it further on my side.

    Looking forward to your reply.

    Plugin Support Chika Ibeneme

    (@chikaibeneme)

    Hi @hmpgit

    It appears that there hasn’t been any recent activity on this thread, so we’ll consider it resolved. However, if you have any additional questions or concerns, please open a Support Ticket on our Help Desk.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Tweaks – Show past events in reverse order Breaks site’ is closed to new replies.