Open ghost opened 7 years ago
Comment by @coreymckrill:
Needs Patch
Good First Bug
accepted
This would require creating a new plugin or enhancing the core CampTix plugin to add a new REST API endpoint for the tix_attendee
post type. The controller for the endpoint would need to follow similar logic to the [camptix_attendees]
shortcode to ensure that attendees marked as "private" do not get included in the response. There would also probably need to be a way within the UI to mark which questions/answers get included as fields in the REST response. And it would need to be possible to filter by ticket type.
Comment by slackbot:
This ticket was mentioned in Slack in #meta-wordcamp by coreymckrill. View the logs.
Here's a first patch for the attendees endpoint. The patch exposes wp-json/wp/v2/tix_attendees
endpoint and it can use the same parameters than the posts
endpoint with some changes:
per_page
parameter (same than the [camptix]
shortcode)Not done yet:
Still, without the questions, I think the endpoint is pretty usable already.
Comment by @igmoweb:
Comment by @iandunn:
I haven't had a chance to look closely at the patch, but it looks to be going in the right direction at first glance.
We might want to use wcorg_register_meta_only_on_endpoint()
from helper-functions.php
, to avoid the privacy issues explained in that function's docblock. I can't think of a use case where exposing first/last names would be a big deal, but there could be one that I haven't thought of yet.
@iandunn
I'm uploading a new patch. I had to add 'custom-fields'
to support
array when the post type is registered. I'm not sure if there's any security concern about it but I had no other way if I wanted to return the meta
array in the response.
The questions are still missing but I don't really know if adding a new tab in Camptix settings would worth it as I guess no WC organizer will care about the REST API. I think the Twitter username and site URL would be more interesting to add. I see that there are a few actions hooked into the attendees shortcode like camptix_question_field_twitter
. I'm thinking if it would be a good idea to check if has_action( 'camptix_question_field_twitter' )
or similar and then display that field in the response or not. I can't think right now on another way to decide if the field should appear or not.
Comment by @igmoweb:
Comment by slackbot:
This ticket was mentioned in Slack in #meta-wordcamp by ryelle. View the logs.
Given that we've seen a lot of WordCamp attendee pages being scraped and their emails being digged based on that from the web, I'm a bit against on making that any easier by opening the attendee data even the slightest with a format that is even more easily scrapable.
Imported from https://meta.trac.wordpress.org/ticket/2940 Created by @codexdemon:
Is there way to get JSON of WordCamp Attendee, was working on attendee page in android so i could not able to figure out WP Json for Attendee of Camptix