Making WordPress.org


Ignore:
Timestamp:
05/24/2018 09:33:14 PM (8 years ago)
Author:
coreymckrill
Message:

WordCamp tickets: privacy enhancements

  • Include some custom registration fields in personal data export/erasure
  • Add registration field to opt-out of the public Attendees page
  • Show data confidentiality notice on Edit Attendee screen
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/camptix-tweaks/camptix-tweaks.php

    r7071 r7228  
    2424add_action( 'camptix_form_edit_attendee_custom_error_flags', __NAMESPACE__ . '\disable_attendee_edits'              );
    2525add_action( 'transition_post_status',                        __NAMESPACE__ . '\log_publish_to_cancel',        10, 3 );
     26add_filter( 'camptix_privacy_erase_attendee',                __NAMESPACE__ . '\retain_attendee_data',         10, 2 );
     27add_action( 'admin_notices',                                 __NAMESPACE__ . '\admin_notice_attendee_privacy'       );
     28add_filter( 'wp_privacy_personal_data_erasers',              __NAMESPACE__ . '\modify_erasers',                  99 );
    2629
    2730// Miscellaneous
     
    555558    // Code of Conduct field
    556559    require_once( __DIR__ . '/addons/code-of-conduct.php' );
     560    // Privacy field
     561    require_once( __DIR__ . '/addons/privacy.php' );
    557562}
    558563
     
    565570 */
    566571function modify_default_fields_list( $default_fields ) {
    567     return __( 'Top three fields: First name, last name, e-mail address.<br />Bottom three fields: Life-threatening allergy, accessibility needs, Code of Conduct agreement.', 'wordcamporg' );
     572    return __( 'Top three fields: First name, last name, e-mail address.<br />Bottom four fields: Attendee list opt-out, life-threatening allergy, accessibility needs, Code of Conduct agreement.', 'wordcamporg' );
    568573}
    569574
     
    944949    return $shortcode_contents;
    945950}
     951
     952/**
     953 * Modify the list of personal data eraser callbacks.
     954 *
     955 * @param array $erasers
     956 *
     957 * @return array mixed
     958 */
     959function modify_erasers( $erasers ) {
     960    // Temporarily disable the default eraser callbacks for CampTix.
     961    unset( $erasers['camptix-attendee'] );
     962
     963    return $erasers;
     964}
     965
     966/**
     967 * Short-circuit the CampTix attendee data erasure callback if the attendee data is still within the retention period.
     968 *
     969 * @param bool|string $erase
     970 * @param WP_Post     $post
     971 *
     972 * @return bool|string
     973 */
     974function retain_attendee_data( $erase, $post ) {
     975    $created          = strtotime( get_the_date( 'c', $post ) );
     976    $now              = time();
     977    $retention_period = YEAR_IN_SECONDS * 3;
     978
     979    if ( ( $now - $created ) < $retention_period ) {
     980        return __( 'Attendee data could not be anonymized because it is still within the data retention period.', 'wordcamporg' );
     981    }
     982
     983    return $erase;
     984}
     985
     986/**
     987 * Add a notice about data confidentiality to the Edit Attendee screen.
     988 */
     989function admin_notice_attendee_privacy() {
     990    $screen = get_current_screen();
     991
     992    if ( 'tix_attendee' === $screen->id ) {
     993        $notice_classes = 'notice notice-info';
     994        $message        = wp_kses_post( sprintf(
     995            __( 'The personal information displayed here is <strong>confidential</strong>, and should not be shown publicly, except under the circumstances described in the <a href="%s">privacy policy</a>.', 'wordcamporg' ),
     996            esc_url( get_privacy_policy_url() )
     997        ) );
     998
     999        printf(
     1000            '<div class="%1$s">%2$s</div>',
     1001            esc_attr( $notice_classes ),
     1002            wpautop( $message )
     1003        );
     1004    }
     1005}
Note: See TracChangeset for help on using the changeset viewer.