Changeset 7228
- Timestamp:
- 05/24/2018 09:33:14 PM (7 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/camptix-tweaks
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/camptix-tweaks/addons/accommodations.php
r7190 r7228 49 49 // Metabox 50 50 add_filter( 'camptix_metabox_attendee_info_additional_rows', array( $this, 'add_metabox_row' ), 12, 2 ); 51 52 // Privacy 53 add_filter( 'camptix_privacy_attendee_props_to_export', array( $this, 'attendee_props_to_export' ) ); 54 add_filter( 'camptix_privacy_export_attendee_prop', array( $this, 'export_attendee_prop' ), 10, 4 ); 55 add_filter( 'camptix_privacy_attendee_props_to_erase', array( $this, 'attendee_props_to_erase' ) ); 56 add_action( 'camptix_privacy_erase_attendee_prop', array( $this, 'erase_attendee_prop' ), 10, 3 ); 51 57 } 52 58 … … 335 341 return 'en_US'; 336 342 } 343 344 /** 345 * Include the new field in the personal data exporter. 346 * 347 * @param array $props 348 * 349 * @return array 350 */ 351 public function attendee_props_to_export( $props ) { 352 $props[ 'tix_' . self::SLUG ] = $this->question; 353 354 return $props; 355 } 356 357 /** 358 * Add the new field's value and label to the aggregated personal data for export. 359 * 360 * @param array $export 361 * @param string $key 362 * @param string $label 363 * @param WP_Post $post 364 * 365 * @return array 366 */ 367 public function export_attendee_prop( $export, $key, $label, $post ) { 368 if ( 'tix_' . self::SLUG === $key ) { 369 $value = get_post_meta( $post->ID, 'tix_' . self::SLUG, true ); 370 371 if ( isset( $this->options[ $value ] ) ) { 372 $value = $this->options[ $value ]; 373 } 374 375 if ( ! empty( $value ) ) { 376 $export[] = array( 377 'name' => $label, 378 'value' => $value, 379 ); 380 } 381 } 382 383 return $export; 384 } 385 386 /** 387 * Include the new field in the personal data eraser. 388 * 389 * @param array $props 390 * 391 * @return array 392 */ 393 public function attendee_props_to_erase( $props ) { 394 $props[ 'tix_' . self::SLUG ] = 'camptix_yesno'; 395 396 return $props; 397 } 398 399 /** 400 * Anonymize the value of the new field during personal data erasure. 401 * 402 * @param string $key 403 * @param string $type 404 * @param WP_Post $post 405 */ 406 public function erase_attendee_prop( $key, $type, $post ) { 407 if ( 'tix_' . self::SLUG === $key ) { 408 $anonymized_value = wp_privacy_anonymize_data( $type ); 409 update_post_meta( $post->ID, $key, $anonymized_value ); 410 } 411 } 337 412 } 338 413 -
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/camptix-tweaks/addons/allergy.php
r7190 r7228 47 47 // Metabox 48 48 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 ); 49 55 } 50 56 … … 333 339 return 'en_US'; 334 340 } 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 } 335 410 } 336 411 -
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/camptix-tweaks/addons/code-of-conduct.php
r7190 r7228 55 55 printf( 56 56 /* translators: %s placeholder is a URL */ 57 wp_kses_post( __( 'Do you agree to follow the event <a href="%s" >Code of Conduct</a>?', 'wordcamporg' ) ),57 wp_kses_post( __( 'Do you agree to follow the event <a href="%s" target="_blank">Code of Conduct</a>?', 'wordcamporg' ) ), 58 58 esc_url( $coc_url ) 59 59 ); -
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/camptix-tweaks/camptix-tweaks.php
r7071 r7228 24 24 add_action( 'camptix_form_edit_attendee_custom_error_flags', __NAMESPACE__ . '\disable_attendee_edits' ); 25 25 add_action( 'transition_post_status', __NAMESPACE__ . '\log_publish_to_cancel', 10, 3 ); 26 add_filter( 'camptix_privacy_erase_attendee', __NAMESPACE__ . '\retain_attendee_data', 10, 2 ); 27 add_action( 'admin_notices', __NAMESPACE__ . '\admin_notice_attendee_privacy' ); 28 add_filter( 'wp_privacy_personal_data_erasers', __NAMESPACE__ . '\modify_erasers', 99 ); 26 29 27 30 // Miscellaneous … … 555 558 // Code of Conduct field 556 559 require_once( __DIR__ . '/addons/code-of-conduct.php' ); 560 // Privacy field 561 require_once( __DIR__ . '/addons/privacy.php' ); 557 562 } 558 563 … … 565 570 */ 566 571 function 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' ); 568 573 } 569 574 … … 944 949 return $shortcode_contents; 945 950 } 951 952 /** 953 * Modify the list of personal data eraser callbacks. 954 * 955 * @param array $erasers 956 * 957 * @return array mixed 958 */ 959 function 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 */ 974 function 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 */ 989 function 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.