芝麻web文件管理V1.00
编辑当前文件:/home/prismawe/clients/origami-events.com/wp-content/plugins/events-manager/em-data-privacy.php
booking_id) || !empty($EM_Object->post_id)) ) return; //already saved so consent was given at one point $label = get_option('dbem_data_privacy_consent_text'); if( function_exists('get_the_privacy_policy_link') ) $label = sprintf($label, get_the_privacy_policy_link()); if( is_user_logged_in() ){ //check if consent was previously given and check box if true $consent_given_already = get_user_meta( get_current_user_id(), 'em_data_privacy_consent', true ); if( !empty($consent_given_already) && get_option('dbem_data_privacy_consent_remember') == 1 ) return; //ignore if consent given as per settings if( !empty($consent_given_already) && get_option('dbem_data_privacy_consent_remember') == 2 ) $checked = true; } if( empty($checked) && !empty($_REQUEST['data_privacy_consent']) ) $checked = true; ?>
>
booking_meta['consent'] = true; } return $result; } /** * Validates a bookng to ensure consent is/was given. * @param bool $result * @param EM_Booking $EM_Booking * @return bool */ function em_data_privacy_consent_booking_validate( $result, $EM_Booking ){ if( is_user_logged_in() && ($EM_Booking->person_id == get_current_user_id() || $EM_Booking->person_id === null) ){ //check if consent was previously given and ignore if settings dictate so $consent_given_already = get_user_meta( get_current_user_id(), 'em_data_privacy_consent', true ); if( !empty($consent_given_already) && get_option('dbem_data_privacy_consent_remember') == 1 ) return $result; //ignore if consent given as per settings } if( empty($EM_Booking->booking_meta['consent']) ){ $EM_Booking->add_error( sprintf(__('You must allow us to collect and store your data in order for us to process your booking.', 'events-manager')) ); $result = false; } return $result; } /** * Updates or adds the consent date of user account meta if booking was submitted by a user and consent was given. * @param bool $result * @param EM_Booking $EM_Booking * @return bool */ function em_data_privacy_consent_booking_save( $result, $EM_Booking ){ if( $result ){ if( $EM_Booking->person_id != 0 ){ update_user_meta( $EM_Booking->person_id, 'em_data_privacy_consent', current_time('mysql') ); } } return $result; } /** * Save consent to event or location object * @param bool $result * @param EM_Event|EM_Location $EM_Object * @return bool */ function em_data_privacy_cpt_get_post($result, $EM_Object ){ if( !empty($_REQUEST['data_privacy_consent']) ){ if( get_class($EM_Object) == 'EM_Event' ){ $EM_Object->event_attributes['_consent_given'] = 1; $EM_Object->get_location()->location_attributes['_consent_given'] = 1; }else{ $EM_Object->location_attributes['_consent_given'] = 1; } } return $result; } /** * Validate the consent provided to events and locations. * @param bool $result * @param EM_Event|EM_Location $EM_Object * @return bool */ function em_data_privacy_cpt_validate( $result, $EM_Object ){ if( !empty($EM_Object->post_id) ) return $result; if( is_user_logged_in() ){ //check if consent was previously given and ignore if settings dictate so $consent_given_already = get_user_meta( get_current_user_id(), 'em_data_privacy_consent', true ); if( !empty($consent_given_already) && get_option('dbem_data_privacy_consent_remember') == 1 ) return $result; //ignore if consent given as per settings } $attributes = get_class($EM_Object) == 'EM_Event' ? 'event_attributes':'location_attributes'; if( empty($EM_Object->{$attributes}['_consent_given']) ){ $EM_Object->add_error( sprintf(__('Please check the consent box so we can collect and store your submitted information.', 'events-manager')) ); $result = false; } return $result; } /** * When an event or location is saved and consent is given or supplied again, update user account with latest consent date IF the object isn't associated with an anonymous user. * @param bool $result * @param EM_Event|EM_Location $EM_Object * @return bool */ function em_data_privacy_cpt_save( $result, $EM_Object ){ $attributes = get_class($EM_Object) == 'EM_Event' ? 'event_attributes':'location_attributes'; if( $result && !empty($EM_Object->{$attributes}['_consent_given'])){ if( !get_option('dbem_events_anonymous_submissions') || $EM_Object->post_author != get_option('dbem_events_anonymous_user') ){ update_user_meta( $EM_Object->post_author, 'em_data_privacy_consent', current_time('mysql') ); } } return $result; }