Support Forum Support Forum GDPR Cookie Compliance Modal after pressed the allow button

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • January 06, 2020 @ 3:04 pm

    Hello! Please delete the modal from the DOM after the user press the “Allow all” button, because the plugin is actualy just hide this element!
    Thank you!

    Moove Agency
    January 07, 2020 @ 2:06 pm

    Hi mow187,

    Thanks for using our plugins.

    We can help to achieve the requested results, you can add the following code snippets to your functions.php

    /**
     * Enable force reload
     */
    add_action( 'gdpr_force_reload', '__return_true' );
    /**
     * Overriding the default banner & modal HTML once the visitors saved preferences
     */
    add_action( 'gdpr_modal_base_module', 'gdpr_cc_remove_hidden_elements', 10, 1 ); 
    add_action( 'gdpr_infobar_base_module', 'gdpr_cc_remove_hidden_elements', 10, 1 );
    add_action( 'gdpr_branding_styles_module', 'gdpr_cc_remove_hidden_elements', 10, 1 );
    add_action( 'gdpr_floating_button_module', 'gdpr_cc_remove_hidden_elements', 10, 1 );
    
    function gdpr_cc_remove_hidden_elements( $modal_html ) {
    	if ( function_exists( 'gdpr_cookie_is_accepted' ) ) :
    	  /* supported types: 'strict', 'thirdparty', 'advanced' */
    	  if ( gdpr_cookie_is_accepted( 'strict' ) && ( gdpr_cookie_is_accepted( 'thirdparty' ) || gdpr_cookie_is_accepted( 'advanced' ) ) ) :
    			// This means the user saved the preferences and you don't need to show the modal
    	  	return '';
    	  endif;
    	endif;
    	return $modal_html;
    };

    The reason why we keep the HTML in the DOM is because:
    1. There is a floating button option, which allow the users to make changes on their preferences. For example, you clicked to accept all, but you decide to turn off the 3rd party cookies, using the floating button you are able to change the preferences.
    2. You can use links (#gdpr_cookie_modal) allowing your visitors to open the settings screen and make some changes

    So we hope you understand the reason why this part of the plugin is hidden but part of the DOM.

    Using the code snippets above, you can remove the plugin HTML (settings screen, cookie banner, floating banner, inline styling) if the visitors accepts the cookies.

    Hope this helps.

    January 07, 2020 @ 2:41 pm

    Thank you for the fast help!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Modal after pressed the allow button’ is closed to new replies.