• Resolved Raul Illana

    (@raulillana)


    Howdy and happy new year!

    I need to check from my custom code if the active user accepted or not the GDPR compliance, before printing or not some more code.

    What’s the correct way to do this?

    Can’t figure it out looking at the hooks or searching the topics on this support forum.

    Thanks in advance. Best wishes!
    R

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Moove Agency

    (@mooveagency)

    Hi there,

    Thanks for your comments.
    Below the PHP hooks:

    – You can check if the “Strictly Necessary Cookies” are accepted or not (return true if is accepted, false if not accepted): ?gdpr_cookie_is_accepted( 'strict' )
    – You can check if the “Third Party Cookies” are accepted or not (return true if is accepted, false if not accepted): ?gdpr_cookie_is_accepted( 'thirdparty' )
    – You can check if the “Advanced Cookies” are accepted or not (return true if is accepted, false if not accepted): ?gdpr_cookie_is_accepted( 'advanced' )

    Note: You have to enable the force reload by adding the following line to the functions.php otherwise the hidden texts becomes visible for your visitors with the next page load. add_action( 'gdpr_force_reload', '__return_true' );

    So based on the functions listed above, you can create your own conditions in your theme to display the relevant content based on the selected user preferences:

    if ( function_exists( 'gdpr_cookie_is_accepted' ) ) :
       if ( gdpr_cookie_is_accepted( 'thirdparty' ) ) :
         echo "GDPR third party ENABLED content";
       else :
         echo "GDPR third party RESTRICTED content";
       endif;
    endif;

    I hope this helps.

    Thread Starter Raul Illana

    (@raulillana)

    Perfect. Thanks! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Check Compliance User Status from PHP’ is closed to new replies.