-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log ticket purchases via usermeta on user profile #1418
base: production
Are you sure you want to change the base?
Conversation
*/ | ||
function log_ticket_purchase_on_user_profile( $attendee ) { | ||
$user_id = get_current_user_id(); | ||
$purchase_history = get_user_meta( $user_id, 'wordcamp_ticket_history', true ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be a single user meta or can it be multiple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a single entry works for how I currently store the data. But yeah I should save it in a way that allows multiple access as it would make the structure and data access clearer.
$ticket_id = intval( get_post_meta( $attendee->ID, 'tix_ticket_id', true ) ); | ||
$ticket = get_post( $ticket_id ); | ||
$ticket_type = $ticket->post_title; | ||
$ticket_price = $this->append_currency( (float) get_post_meta( $attendee->ID, 'tix_ticket_price', true ), false ); | ||
$purchase_date = $attendee->post_date; | ||
$edit_token = get_post_meta( $attendee->ID, 'tix_edit_token', true ); | ||
$edit_link = $this->get_edit_attendee_link( $attendee->ID, $edit_token ); | ||
$access_token = get_post_meta( $attendee->ID, 'tix_access_token', true ); | ||
$access_link = $this->get_access_tickets_link( $access_token ); | ||
$ticket_status = $attendee->post_status; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are all these values needed to be stored in usermeta, or could it link to a purchase on the individual site?
return; | ||
} | ||
|
||
foreach ( $purchase_history as $index => $ticket ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by storing as a large single meta, this type of loop in then necessary, which appears difficult to understand 😄
Currently, the ticket-related data is stored in usermeta after ticket purchase completion, and then fetched directly from usermeta on the profile. wporg-profiles/class-wporg-profiles.ph
Alternatively, should we instead only save the user_id and attendee_id after purchase completion, then handle the data fetching and displaying on the Profile (similar to how activity is handled)? This approach could involve creating a new one-to-many Or stroing only the WordCamp ID and attendee ID in usermeta, then accessing the data on the profile to retrieve and render the tickets the user purchased for different WordCamps. Would this be more efficient in the long term? Using user_meta for Each Ticket Cons: Using a Custom One-to-Many Table Cons: |
Regarding the UI, it currently uses a table layout for desktop. For mobile, I'm thinking an accordion style might work well, showing only the event name initially, with more details revealed when the section is expanded. Any other suggestions? cc @WordPress/meta-design |
Responsive tables are hard. If someone else chimes in with more time to help, I think a good design iteration could be spent making this shine. But as far as small fixes to get this PR going, I would do one of two things:
For 2, that might be accordions, or it might just be listing things out. The table may be useful, I hhave not organized enough wordcamps to know this, but with just 4 items, you might just list them out in bullets. WordCamp Testing 2019
WordCamp Testing 2019
|
This PR tries to update the usermeta upon ticket purchase completion, enabling the purchased tickets to be displayed on the user profile. It also updates the display to reflect the corresponding status after a refund.
Currently, during a transfer (changing the name via Edit), there is no field to specify the transferee's .org account, so after the transfer, the ticket still appears in the purchaser's profile.
And if multiple tickets are purchased at once, though they are displayed in separate rows on the profile, pressing refund on one of these tickets will refund all tickets purchased in that transaction.
For the mobile UI, switching to a card-style layout could improve the design.
Any thoughts or suggestions?
See #1411
Screencasts
Screen.Capture.on.2024-10-29.at.03-14-03.mov
Screenshots
How to test the changes in this Pull Request:
While sandboxed
wp-content/plugins/camptix/camptix.php
wporg-profiles/class-wporg-profiles.php
single/profile.php
wp-content/plugins/camptix/camptix.php
wporg-profiles/class-wporg-profiles.php
single/profile.php