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/addons/allergy.php

    r7190 r7228  
    4747        // Metabox
    4848        add_filter( 'camptix_metabox_attendee_info_additional_rows', array( $this, 'add_metabox_row' ), 11, 2 );
     49
     50        // Privacy
     51        add_filter( 'camptix_privacy_attendee_props_to_export', array( $this, 'attendee_props_to_export' ) );
     52        add_filter( 'camptix_privacy_export_attendee_prop', array( $this, 'export_attendee_prop' ), 10, 4 );
     53        add_filter( 'camptix_privacy_attendee_props_to_erase', array( $this, 'attendee_props_to_erase' ) );
     54        add_action( 'camptix_privacy_erase_attendee_prop', array( $this, 'erase_attendee_prop' ), 10, 3 );
    4955    }
    5056
     
    333339        return 'en_US';
    334340    }
     341
     342    /**
     343     * Include the new field in the personal data exporter.
     344     *
     345     * @param array $props
     346     *
     347     * @return array
     348     */
     349    public function attendee_props_to_export( $props ) {
     350        $props[ 'tix_' . self::SLUG ] = $this->question;
     351
     352        return $props;
     353    }
     354
     355    /**
     356     * Add the new field's value and label to the aggregated personal data for export.
     357     *
     358     * @param array   $export
     359     * @param string  $key
     360     * @param string  $label
     361     * @param WP_Post $post
     362     *
     363     * @return array
     364     */
     365    public function export_attendee_prop( $export, $key, $label, $post ) {
     366        if ( 'tix_' . self::SLUG === $key ) {
     367            $value = get_post_meta( $post->ID, 'tix_' . self::SLUG, true );
     368
     369            if ( isset( $this->options[ $value ] ) ) {
     370                $value = $this->options[ $value ];
     371            }
     372
     373            if ( ! empty( $value ) ) {
     374                $export[] = array(
     375                    'name'  => $label,
     376                    'value' => $value,
     377                );
     378            }
     379        }
     380
     381        return $export;
     382    }
     383
     384    /**
     385     * Include the new field in the personal data eraser.
     386     *
     387     * @param array $props
     388     *
     389     * @return array
     390     */
     391    public function attendee_props_to_erase( $props ) {
     392        $props[ 'tix_' . self::SLUG ] = 'camptix_yesno';
     393
     394        return $props;
     395    }
     396
     397    /**
     398     * Anonymize the value of the new field during personal data erasure.
     399     *
     400     * @param string  $key
     401     * @param string  $type
     402     * @param WP_Post $post
     403     */
     404    public function erase_attendee_prop( $key, $type, $post ) {
     405        if ( 'tix_' . self::SLUG === $key ) {
     406            $anonymized_value = wp_privacy_anonymize_data( $type );
     407            update_post_meta( $post->ID, $key, $anonymized_value );
     408        }
     409    }
    335410}
    336411
Note: See TracChangeset for help on using the changeset viewer.