Forum Replies Created
-
AuthorPosts
-
December 13, 2016 at 2:23 am in reply to: Mysql error when searching for events in administration #1205100
Geir Hagen
ParticipantYes, it was the magic-fields plugin that did modify the search query. Thanks.
April 30, 2016 at 7:47 am in reply to: Add add_filter to organizer and venues for importing custom data. #1109092Geir Hagen
ParticipantGreat @George! But i just can see this change in the github repo. In the latest release (4.1.3) through WP this is not added. Do you have any idea when this will be pushed to an official release?
April 27, 2016 at 8:20 am in reply to: Add add_filter to organizer and venues for importing custom data. #1107693Geir Hagen
ParticipantYes analogue hooks is what im looking for. To put it in perspective and if someone is looking for a temporary solution ill describe what i do to make this work.
My client requires sorting of organizers by location, not in relation to events so
what i had to do is to edit the function get_organizer_column_names() in Column_Mapper.php and function build_organizer_array() in File_Importer_Organizers.php. In these functions i added a new record in their respectively contained arrays.Example:
File_Importer_Organizer.php:private function build_organizer_array( $organizer_id, array $record ) { $featured_image_content = $this->get_value_by_key( $record, 'featured_image' ); $featured_image = $organizer_id ? '' === get_post_meta( $organizer_id, '_wp_attached_file', true ) : $this->featured_image_uploader( $featured_image_content )->upload_and_get_attachment(); $organizer = array( 'Organizer' => $this->get_value_by_key( $record, 'organizer_name' ), 'Email' => $this->get_value_by_key( $record, 'organizer_email' ), 'Phone' => $this->get_value_by_key( $record, 'organizer_phone' ), 'Website' => $this->get_value_by_key( $record, 'organizer_website' ), 'FeaturedImage' => $featured_image, 'fylke' => $this->get_value_by_key( $record, 'organizer_fylke' ), // ROD ); return $organizer; }Column_Mapper.php:
private function get_organizer_column_names() { return array( 'organizer_name' => esc_html__( 'Organizer Name', 'the-events-calendar' ), 'organizer_email' => esc_html__( 'Organizer Email', 'the-events-calendar' ), 'organizer_website' => esc_html__( 'Organizer Website', 'the-events-calendar' ), 'organizer_phone' => esc_html__( 'Organizer Phone', 'the-events-calendar' ), 'featured_image' => esc_html__( 'Organizer Featured Image', 'the-events-calendar' ), 'organizer_fylke' => esc_html__( 'Arrangørens Fylke', 'the-events-calendar' ) // ROD ); }Now i just listen for a updated or added meta and attach the newly observed postmeta data to AFC.
function rod_observe_events_update( $post_id ) { $meta = get_post_meta ($post_id, "_Organizerfylke", true ); if (!empty($meta)){ // do the custom fields insert update_field( "acf_fylke", $meta, $post_id ); } } // this fn looks for our special meta, and runs the fn for updating the custom fields function rod_observe_events__meta( $meta_id, $post_id, $meta_key, $meta_value ) { if ($meta_key === "_Organizerfylke"){ rod_observe_events_update( $post_id ); } } add_action('save_post_tribe_organizer', 'rod_observe_events_update' ); add_action('updated_post_meta', 'rod_observe_events__meta', 10, 4 ); add_action('added_post_meta', 'rod_observe_events__meta', 10, 4 );As you can see it would be nice to have access to a filter hook for these arrays so i dont have to edit the base code for the plugin.
-
This reply was modified 10 years ago by
Geir Hagen.
Geir Hagen
ParticipantYes it works! Thanks!
Geir Hagen
ParticipantOutstanding!
Geir Hagen
ParticipantSame here with the organizer import. Thanks!
-
This reply was modified 10 years ago by
-
AuthorPosts
