Support » Plugin: My Calendar » Image template tag not working after my caledar upgrade

  • Resolved poehnix

    (@poehnix)


    Hi,
    I upgraded my calendar from a 2.2.x version to latest release. Upgrade went mostly fine but all image template tags, like {image} stopped working.
    Images are there, I can see them if I edit an event, but they don’t show if I use any of the related tags in a template. ( I am trying to customize the “list template”)
    If I reset the template unckecking the “Use this list event template” images do show.
    No php errors or warnings are appear in the logs.
    I have no clue on what may be causing the issue.
    Server is using PHP version 5.5.28 on linux
    Any help will be appreciated.
    Thank you
    Michele

    https://wordpress.org/plugins/my-calendar/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter poehnix

    (@poehnix)

    Followup after some debugging:
    in function my_calendar_draw_event (file my-calendar-output.php)

    $event->event_image has image url

    while

    $data=mc_create_tags($event);

    has no relevant image dat, even if post has a featured image

    mc_create_tags calls mc_filter_image_data using a filter, so function

    mc_image_data($e,$event)

    fails to return any image data.
    What happens, probably is that a block of code is not executed

    if ( isset( $event->event_post ) && is_numeric( $event->event_post ) && get_post_status( $event->event_post ) ) {
    get image data from post (FAILS: NO DATA RETURNED)
    }
    else{
    get image data from event (NEVER ENTER HERE ?)
    }

    I still have no idea why all image info taken pfrom the post are empty even if featured image is there

    ["full"]=> string(0) "" ["thumbnail"]=> string(0) "" ["thumbnail_url"]=> NULL ["medium"]=> string(0) "" ["medium_url"]=> NULL ["large"]=> string(0) "" ["large_url"]=> NULL ["post-thumbnail"]=> string(0) "" ["post-thumbnail_url"]=> NULL ["image_url"]=> string(0) "" ["image"]=> string(0) ""

    Plugin Author Joe Dolson

    (@joedolson)

    What it sounds like to me is that the event post exists, but the featured image is not attached to the event post. That could be because of a migration issue – it’s hard to say. I’d have to see inside your installation to really be able to tell.

    I’ll add an additional check to that which verifies whether or not there’s a featured image attached to the post in question, so that fallback will work.

    Thread Starter poehnix

    (@poehnix)

    Thank you very much Joe,
    as a momentaneus hack, in function mc_image_data(), right before returning the image data I copied the code that never gets executed

    $e['image_url'] = ( $event->event_image != '' ) ? $event->event_image : '';
       $e['image']     = ( $event->event_image != '' ) ? "<img src='$event->event_image' alt='' class='mc-image' />" : '';

    but of course this does not really solve the problem.
    I will upgrade my calendar as soon as next version is out. I hope the information I was able to provide will help you if someone else has the same problem.
    Thank you again
    Michele

    Thread Starter poehnix

    (@poehnix)

    Joe, I confirm problem got fixed after upgrading to 2.4.9

    Thank you very much
    Michele

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Image template tag not working after my caledar upgrade’ is closed to new replies.