• Resolved fernandosumun

    (@fernandosumun)


    Hi,

    I’m trying to avoid script injection if user is logged in. It’s working propperly the first time I enter the website (logged out) and click on “Accept cookies”: scripts are injected after clicking the button.

    I use these hooks for remove scripts when a user log in, but if I log in the scripts remain active. To make the scripts dissapear I have to save GRPD cookie compliance settings again, but it only works once, if I log out scripts don’t inject again.

    Thanks in advance

    add_action(‘moove_gdpr_third_party_header_assets’,’moove_gdpr_third_party_header_assets’);
    function moove_gdpr_third_party_header_assets( $scripts ) {
    if (is_user_logged_in()) {
    $scripts = ‘<script>console.log(“scripts-head-anulados”);</script>’;
    }
    return $scripts;
    }
    add_action(‘moove_gdpr_third_party_body_assets’,’moove_gdpr_third_party_body_assets’);
    function moove_gdpr_third_party_body_assets( $scripts ) {
    if (is_user_logged_in()) {
    $scripts = ‘<script>console.log(“scripts-body-anulados”);</script>’;
    }
    return $scripts;
    }
    add_action(‘moove_gdpr_third_party_footer_assets’,’moove_gdpr_third_party_footer_assets’);
    function moove_gdpr_third_party_footer_assets( $scripts ) {
    if (is_user_logged_in()) {
    $scripts = ‘<script>console.log(“scripts-footer-anulados”);</script>’;
    }
    return $scripts;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • MA

    (@gasparnemes)

    Hi @fernandosumun,

    Thanks for using our plugins.

    You have to disable the script caching by adding the following code snippet to your functions.php

    add_filter('gdpr_cookie_script_cache','gdpr_prevent_script_cache');
    function gdpr_prevent_script_cache() {
    return array();
    }

    Hope this helps.

    Thread Starter fernandosumun

    (@fernandosumun)

    Working properly.
    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hooks not responding (transients or cache interferring?)’ is closed to new replies.