Support » Plugin: Events Manager » Change error message for data protection checkbox

  • Resolved vonJanne

    (@vonjanne)


    Hi!

    I have added the checkbox to accept our data privacy policy (required), and now I need to change the error message which is displayed if a user tries to book without checking that box. Where do I find that message?

    Thanks!
    j

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    here’s another snippet which may help you with this –

    
    /**
     * Validates a bookng to ensure consent is/was given.
     * @param bool $result
     * @param EM_Booking $EM_Booking
     * @return bool
     */
    function theme_custom_em_data_privacy_consent_booking_validate( $result, $EM_Booking ){
    	
    	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
    	}
        if( empty( $EM_Booking->booking_meta['consent'] ) ){
    	    $EM_Booking->add_error( sprintf( __( 'PUT_YOUR_CUSTOM_MESSAGE_HERE', 'events-manager' ) ) );
    	    $result = false;
        }
        return $result;
    }
    
    function theme_custom_em_data_privacy_consent_hooks(){
    	//BOOKINGS
    	if( get_option( 'dbem_data_privacy_consent_bookings' ) == 1 || ( get_option( 'dbem_data_privacy_consent_bookings' ) == 2 && !is_user_logged_in() ) ){
    		remove_filter( 'em_booking_validate', 'em_data_privacy_consent_booking_validate', 10, 2 );
    		add_filter( 'em_booking_validate', 'theme_custom_em_data_privacy_consent_booking_validate', 10, 2 );
    	}
    }
    
    add_action( 'init', 'theme_custom_em_data_privacy_consent_hooks' );
    

    As for where to paste this : http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/

Viewing 1 replies (of 1 total)
  • The topic ‘Change error message for data protection checkbox’ is closed to new replies.