Support

Home Forums Event Espresso Premium How to get People Admin foreach Event ?

How to get People Admin foreach Event ?

Posted: September 26, 2018 at 1:14 am


Praxis

September 26, 2018 at 1:14 am

I have 2 types of Admin People: Staff and Speakers. Foreach Event i assign with plugin EE4 People Add-on, Speakers. I want to get all speakers for one page event, with php code.


Praxis

September 26, 2018 at 2:00 am

Will be great also to get Short Biography of Speaker


Tony

  • Support Staff

September 26, 2018 at 4:25 am

Hi there,

You can use the get_people_for_event_and_type($post_id, $type_id) method on the EEM_Person model to pull ‘people’ of a certain type for an event.

For example:

$people = EE_Registry::instance()->load_model('Person')->get_people_for_event_and_type( $post->ID, 8 );

Which will return an array (yes its still an array even if there is only a single ‘person’) of EE_Person objects, so you can loop over the array and output the details you need, as you have an EE_Person object you can output all of the details you want. I recommend using Kind Debugger plugin and wrapping the person object in d() to view the available methods you can use on that object.

Note that on my example, 8 is an ID of a people type which likey will not match yours. You can find the correct type if in Event Espresso -> People Admin -> Types, use the ID of the people type you want to pull the people from.

The support post ‘How to get People Admin foreach Event ?’ 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