tribe_get_events throwing PHP Warning

Home Forums Calendar Products Events Calendar PRO tribe_get_events throwing PHP Warning

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #806851
    Roger
    Participant

    We updated to latest version of Events Calendar and are now getting the following warning thrown by tribe_get_events().

    Warning: Illegal string offset ‘eventDisplay’ in /home/narecdec/public_html/wp-content/plugins/the-events-calendar/public/template-tags/general.php on line 20

    Our code:
    if( function_exists( ‘tribe_get_events’ ) ) {
    $posts = tribe_get_events( ‘eventDisplay=upcoming&posts_per_page=3’ );
    }

    #807393
    Casey
    Participant

    Roger,
    Thanks for getting in touch! Please try passing in the params as an array to see if that fixes the issue. tribe_get_events() expects the arguments to passed in as an array, so passing them as a string might be causing issues here.

    Give that a shot and see if it does the trick. Thanks! πŸ™‚

    -Casey-

    #825756
    Casey
    Participant

    I just wanted to follow up and see if you’re all set here or if you still have further questions. Just let me know if you have further questions or if I should go ahead and close out this thread. Thanks! πŸ™‚

    -Casey-

    #826483
    Roger
    Participant

    Hi Casey, didn’t see your original response. I’m out of the office today, but will recode as an array tomorrow and test. Seems an odd solution though, as I was pretty sure the underlying Events code was written to work with both arrays and strings (as per the WP ‘usual practice’ for queries etc.). I think Modern Tribe’s own widget also made the call using a string for the parameters.

    Cheers, Roger

    #827332
    Casey
    Participant

    Ok great. I’ll keep this thread open, and await your response. Thanks! πŸ™‚

    -Casey-

    #829353
    Roger
    Participant

    Passing the parameters as an args array solves the issue.
    Did you guys modify the function specification in the latest version of the calendar? The string version didn’t generate warnings previously, and was also the approach used in an Event Calendar widget.

    #847347
    Casey
    Participant

    Roger,
    I’m not aware of any changes that were made to this function that would be causing this issue, but I’ll pass along your feedback to our developers to investigate further.

    Since it looks like you’re all set here, I’ll go ahead and close out this thread. Feel free to start a new thread if you need further help. Thanks! πŸ™‚

    -Casey-

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘tribe_get_events throwing PHP Warning’ is closed to new replies.