Show ‘organiser’ in tooltip

This topic contains 6 replies, has 2 voices, and was last updated by  Denise Wunder 7 years, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #28467

    Dear Stephen,

    how can I add the ‘organiser’ (wordpress user who created the event) to the tooltip? I only need to show this. No description, no time, (maybe no title).

    How can I add this feature without loosing it after updating the plugin?

    Thank you in advance!

    Best regards,

    Martin

    Denise Wunder
    #28477

    Which tooltip? The calendar? You can use the eventorganiser_event_tooltip filter: http://codex.wp-event-organiser.com/hook-eventorganiser_event_tooltip.html

    To get the organiser:

    $organiser_id = (int) get_post($event_id)->post_author;
    $organiser = get_userdata( $organiser_id );
    

    If you mean the venue map, that would be trickier: the tooltip is associated with a venue, not the map. You can use the eventorganiser_venue_tooltip filter (http://codex.wp-event-organiser.com/hook-eventorganiser_venue_tooltip.html) but you would need to determine how you would get the intended event ID From the venue ID.

    Stephen Harris
    #28479

    Dear Stephen,

    you are right, I meant the calendar tooltip, not the venue tooltip.

    Unfortunately, I am not so skilled in PHP coding. Could you give me a more detailed description of what to do? I just need to see the ‘organiser’.

    Thanks so much!

    Denise Wunder
    #28490

    Hi Martin,

    The following in a theme’s functions.php or a custom plugin should do it:

    <?php
    add_filter( 'eventorganiser_event_tooltip', 'my_event_calendar_tooltip_content', 10, 4 );
    function my_event_calendar_tooltip_content( $description, $event_id, $occurrence_id, $post ){
    
        $organiser_id = (int) $post->post_author;
        $organiser = get_userdata( $organiser_id );
        $organiser_name = $organiser->display_name;
    
        //Change first value and return it
        return "Content here... organiser: $organiser_name";
    
    };
    ?>
    

    Please note, you’ll need to update an event before the changes to take effect.

    • This reply was modified 7 years, 2 months ago by  Stephen Harris.
    • This reply was modified 7 years, 2 months ago by  Stephen Harris.
    Stephen Harris
    #28497

    Hi Stepehn,

    I tried both methods.

    First one was to copy the code at the bottom of my themes function.php file without “<?php” on top.

    Second method was to copy the code in a blank php file with “<?php” on top into the wordpress plugin folder.

    Nothing worked, even though I’ve always cleared the cache by updating an event.

    Could it be that I need to have installed EO Pro? So far I’ve only bought the license, but did not installed it, because i only needed your support 😉

    Greetings,

    Martin

    Denise Wunder
    #28506

    There were a few errors in my original code snippet, which I’ve since corrected. Pro is not required.

    The code should go inside <?php ... ?> tags (included in the snippet).

    One easy way to do this is to create a file: .../wp-content/mu-plugins/calendar-tooltip.php and paste the entire contents of that snippet (including the <?php ... ?> tags) into it.

    Stephen Harris
    #28508

    Absolutely fantastic, Stephen!

    Thank you again!

    Denise Wunder
Viewing 7 posts - 1 through 7 (of 7 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.