Support

Home Forums Event Espresso Premium People Addon Customization

People Addon Customization

Posted: February 20, 2020 at 7:20 pm


melissa smith

February 20, 2020 at 7:20 pm

I’d like to add customization so my staff can see columns for date & times of the events I schedule them for. I’d like to update the posts for People add-on so that it is only showing “Upcoming” events and also their date and start time. How can I do this?


Tony

  • Support Staff

February 21, 2020 at 5:30 am

Hi Melissa,

May I ask which specific output you are looking to change above?

Can you can add either a link or a screenshot:

https://eventespresso.com/wiki/troubleshooting-checklist/#screenshots

I just want to confirm we are on the same page before sending you down the wrong path.


melissa smith

February 21, 2020 at 6:47 pm

Like on this: https://theinstantartist.com/people/kailynandrews/

Right now, the page shows events that have passed. I’d like to only have upcoming events on there. And I would like it to show date and start time next to the event’s name.


melissa smith

February 23, 2020 at 8:02 pm

(adding reply to add the ‘Notify via email checkbox’)


Tony

  • Support Staff

February 24, 2020 at 9:29 am

Ok, so to modify that section you’ll need to copy the template used by the people add-on into the root directory of your theme (preferably a child theme).

The template you need is \eea-people-addon\public\templates\content-espresso_people-details.php

By default the people add-on will output a list of events for each ‘type’ a person is assigned to, if you only need a full list of events they are assigned to you can use something like this:

https://gist.github.com/Pebblo/316da15cc653109fd94d3960fffe777f

On line 26 you have an EE_Event object you can use to pull any of the additional details you need.


melissa smith

February 27, 2020 at 6:11 pm

That took care of making the list only upcoming events. But what do I need to have in there to add the date and time?


Tony

  • Support Staff

February 28, 2020 at 6:44 am

espresso_event_date('','',$event->ID, true);

Will output the date and time for primary datetime on the event you passed the ID for using the date and time format set on the site.

Place that in the loop wherever you can the date and time to be output.

For example right after this <?php echo $event->name(); ?> on line 26

Add - <?php espresso_event_date('','',$event->ID, true); ?>


melissa smith

March 9, 2020 at 6:43 pm

I must be doing something wrong because I cannot get the date and time to show up. This is what I have in the child theme folder

<?php
/**
 * Template file to add extra content to a single person display
 * Note: To customize, just copy the template from /public/templates/* and put in your theme folder.
 * @since 1.0.0
 * @package EE People Addon
 * @subpackage  template
 * @author Darren Ethier
 */
global $post;

$where = array(
    'Person_Post.PER_ID' => $post->ID,
    'Person_Post.OBJ_type' => 'Event',
    'Datetime.DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))
);
$events = EEM_Event::instance()->get_all(array($where));
?>
<div class="eea-people-addon-person-events-container">
    <?php if ($events) : ?>
    <h3><?php _e('Events this person is involved with:', 'event_espresso'); ?></h3>
        <div class="eea-people-addon-people-type-container">
            <ul class="eea-people-addon-event-list-ul">
                <?php foreach ($events as $event) : ?>
                    <li>
                        <a class="eea-people-addon-link-to-event" href="<?php echo get_permalink($event->ID()); ?>" title="<?php printf(__('Click here to view more info about %s', 'event_espresso'), $event->name()); ?>"><span class="eea-people-addon-event-name"><?php echo $event->name(); ?> <?php espresso_event_date('','',$event->ID, true); ?></span></a>
                    </li>
                <?php endforeach; ?>
            </ul>
        </div>
    <?php endif; ?>
</div>


Tony

  • Support Staff

March 10, 2020 at 5:54 am

My apologies, my mistake.

This: <?php espresso_event_date('','',$event->ID, true); ?>

Needs to be: <?php espresso_event_date('','',$event->ID(), true); ?>


melissa smith

March 10, 2020 at 6:34 pm

That did it, thanks so much!


melissa smith

March 10, 2020 at 8:27 pm

Is there any way to make it in order of date? Right now there doesn’t seem to be any order


Tony

  • Support Staff

March 11, 2020 at 3:54 am

Sure, I’ve updated my gist to order by the Event start dates in ascending order:

https://gist.github.com/Pebblo/316da15cc653109fd94d3960fffe777f#file-content-espresso_people-details-php-L17-L22

The support post ‘People Addon Customization’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso