Posted: September 11, 2018 at 6:58 am
Hi I am trying to do an PDF export via the DK PDF Plugin. It’s almost done but I can’t load the People View helper to get the data from the instructor of the event.
and got the error message:
How do I get the permission or can I get the information in an other way? |
|
September 11, 2018 at 10:08 am Hi, The People View helper class is intended to be used only on the front end of the site, so it’s not ready to load when doing a PDF export. What you can do instead is build your own custom function from the contents of the |
|
September 11, 2018 at 11:03 am I was wondering, because the Venue_View and the Event_View helper both worked in the export. Is there an other way to get to the information? I would only need the name of the person for that event. |
|
September 11, 2018 at 11:37 am I gave you another way to get the information. If you’d prefer to write a direct SQL you’re welcome to write one, but the helper method code I shared with you will do the SQL query for you. |
|
Hey Josh, I understand, that a custom function would be the best solution but I have the following Error and can’t find a solution.
Could you give me a hint what I have to edit in the custom function or what additional table I have to use for the sql query? function person_objects($obj_id = 0, $primary_obj_type = 'Person') { $kurs_postid = $_GET["kurs_postid"]; $objects = array(); if (empty($obj_id)) { global $post; $obj_id = $post instanceof WP_Post ? $kurs_postid : $obj_id; } // still empty? return empty array if (empty($obj_id)) { return array(); } if ($primary_obj_type != 'Person') { $where = array( 'PER_ID' => $obj_id, 'OBJ_type' => $primary_obj_type ); $query = array( $where ); } else { $where = array( 'OBJ_ID' => $obj_id ); $query = array( $where, 'order_by' => array( 'PER_OBJ_order' => 'ASC' ) ); } $object_items = EEM_Person_Post::instance()->get_all($query); $term_name_cache = array(); if (method_exists(EEM_Event::instance(), 'public_event_stati')) { $public_event_stati = EEM_Event::instance()->public_event_stati(); } else { $public_event_stati = get_post_stati(array( 'public' => true )); foreach (EEM_Event::instance()->get_custom_post_statuses() as $custom_post_status) { $public_event_stati[] = strtolower(str_replace(' ', '_', $custom_post_status)); } } foreach ($object_items as $object_item) { if (! isset($term_name_cache[ $object_item->get('PT_ID') ]) || ! isset($objects[ $term_name ][ $object_item->ID() ])) { $term_name = EEM_Term_Taxonomy::instance()->get_one_by_ID($object_item->get('PT_ID'))->get_first_related('Term')->get('name'); $related_object = $object_item->get_first_related($primary_obj_type, array( array( 'status' => array( 'IN', apply_filters('FHEE__EEH_People_View__get_rel_objects__public_event_stati', $public_event_stati) ) ) )); if ($related_object instanceof EE_Base_Class) { $objects[ $term_name ][ $object_item->ID() ] = $related_object; $term_name_cache[ $object_item->get('PT_ID') ] = $term_name; } } } return $objects; } |
|
Hey Josh, |
|
The support post ‘People to PDF’ 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.