Attendee Information not exporting properly

Home Forums Ticket Products Event Tickets Plus Attendee Information not exporting properly

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1243237
    kelly
    Participant

    When viewing the attendees I see the information they’ve filled out (behind the “View Details” link in the listing). But when I hit “export” only the first row is populated with the extra fields.

    All up-to-date plugins.

    Using Event Tickets Plus with The Events Calendar

    #1243895
    Barry
    Member

    Hi Kelly,

    I’m sorry to hear you’ve hit up against some problems, here.

    Unfortunately, I am unable to replicate. Would you be able to share some more information?

    • I’d love to see your system information (what you shared was useful, but comes from WooCommerce – our own system information covers various event and ticket specific fields that we can’t get via WooCommerce’s sys info)
    • If you are happy to do so, could you share a snapshot of the attendee screen (with details expanded) and the matching CSV export data (if you can ‘zip’ them together you’ll be able to upload them directly to the forums via a private reply – or else you could share via a Dropbox link or similar)
    • Last but not least, you indicated having run through our standard troubleshooting steps already: just to be clear, because you have various plugins relating directly to WooCommerce, can you confirm you tested with only Event Tickets, Event Tickets Plus, The Events Calendar and WooCommerce activated — and none of the supporting plugins?

    Thanks!

    #1243927
    kelly
    Participant

    This reply is private.

    #1244907
    Barry
    Member

    Hi Jennifer (and Kelly!),

    Sorry for the delay in responding!

    I believe your theory is correct. Bear with me while I see if there is some sort of temporary solution I can offer you (though, of course, we’ll also file this as a bug and work on a fix as quickly as possible).

    Thanks!

    #1244924
    Barry
    Member

    So here is a snippet you could add to a custom plugin or to your theme’s functions.php (less ideal – but workable!). I strongly recommend backing up your database — and knowing how to restore it — before doing this:

    class Repair_Data_Fix_74105 {
    	protected $old_slug = '';
    	protected $new_slug = '';
    	protected $candidates = array();
    
    	public function __construct( $old_name, $new_name ) {
    		$this->old_slug = sanitize_title( $old_name );
    		$this->new_slug = sanitize_title( $new_name );
    		add_action( 'init', array( $this, 'repair' ) );
    	}
    
    	public function repair() {
    		$this->find_repair_candidates();
    		$this->do_repairs();
    	}
    
    	protected function find_repair_candidates() {
    		global $wpdb;
    
    		$query = "
    			SELECT post_id
    			FROM   dev_postmeta
    			WHERE  meta_key = '_tribe_tickets_meta'
    			AND    meta_value LIKE %s
    		";
    
    		$this->candidates = $wpdb->get_col(
    			$wpdb->prepare( $query, "%{$this->old_slug}%" )
    		);
    	}
    
    	protected function do_repairs() {
    		foreach ( $this->candidates as $post_id ) {
    			$ticket_attendee_meta = get_post_meta( $post_id, '_tribe_tickets_meta', true );
    
    			if ( is_array( $ticket_attendee_meta ) ) {
    				$ticket_attendee_meta = $this->correct_ticket_attendee_meta( $ticket_attendee_meta );
    				update_post_meta( $post_id, '_tribe_tickets_meta', $ticket_attendee_meta );
    			}
    		}
    	}
    
    	protected function correct_ticket_attendee_meta( array $data ) {
    		if ( isset( $data[ $this->old_slug ] ) ) {
    			$data[ $this->new_slug ] = $data[ $this->old_slug ];
    			unset( $data[ $this->old_slug ] );
    		}
    		
    		foreach ( $data as &$entry ) {
    			if ( ! is_array( $entry ) ) {
    				continue;
    			}
    
    			foreach ( $entry as &$submission ) {
    				if ( isset( $submission[ $this->old_slug ] ) ) {
    					$submission[ $this->new_slug ] = $submission[ $this->old_slug ];
    					unset( $submission[ $this->old_slug ] );
    				}
    			}
    		}
    
    		return $data;
    	}
    }

    To actually make it do something, you’ll need to add a new more lines right after it along these lines:

    new Repair_Data_Fix_74105(
    	'Original Field Name',
    	'New/Current Field Name'
    );

    Hopefully that’s fairly self-explanatory. Refresh any screen/page on your site a few times, confirm the problem (hopefully!) is fixed, then remove the code.

    Again – please! – take the time to backup before doing this.

    Hopefully that provides temporary relief for this issue.

    #1247891
    kelly
    Participant

    Hi there,

    Your solution did work as a work-around for this particular scenario. However, I am still experiencing issues as the client has since added even more meta fields, and edit the old ones again.

    The problem is that the get_meta_fields_by_event( $event_id ) function in /src/Tribe/Meta.php is looking for all CURRENT meta fields set for the ticket.

    However, the problem is that it can’t nab old meta fields.

    So…. the export works fine for those purchases that match the current meta fields exactly, but doesn’t work if a previous purchase was made when there were different meta fields attached to the ticket.

    Is there a function that could cycle through all past purchases of a ticket_id and grab all the meta_fields that were filled out at the time of purchase, and then insert them as columns in the export? Even if that means there will be multiple columns within the export… (for example, two “badge name” columns… with different names)

    Thoughts?

    #1248454
    Barry
    Member

    Hmm, that’s certainly a possibility but I’m afraid we’re unlikely to be able to put together an example of such a solution for you — though of course I’ll update the corresponding bug report to ensure the scenario you described is captured.

    #1646881
    Courtney
    Member

    Hi there

    Just wanted to share with you that a new release of our plugins is out, including a fix for this issue ?

    Find out more about this release → https://theeventscalendar.com/maintenance-release-for-the-week-of-22-october-2018/

    We apologize for the delay and appreciate your patience while we worked on this.

    As always, we suggest to set up a dev/staging site so you can make all plugin updates without disrupting the live site.

    Please update the plugins and see if the fix works for your site.

    Thanks

    Courtney

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Attendee Information not exporting properly’ is closed to new replies.