Great, thanks, I’ll check it out.
In the meantime I tried this:
$current_user = get_currentuserinfo();
$email = $current_user->user_email;
$dataSubject = gdpr('data-subject')->getByEmail($email);
if (!$dataSubject->hasConsented('privacy-policy')) {
// do your thing!
echo 'Consent given by: ';
echo $email; }
Same result, no difference between users with and without given consent.
Here are parts of the output (anonymized, of course). The DataSubject email is correct, but I can’t recognize the “status”-value, so maybe that’s the fault?
USER without consent
object(Codelight\GDPR\DataSubject\DataSubject)#9814 (5) { ["email":protected]=> string(19) "[email protected]" ["user":protected]=> object(WP_User)#10146 (8) { ["data"]=> ....
["consentManager":protected]=> object(Codelight\GDPR\Components\Consent\ConsentManager)#1480 (3) { ["model":protected]=> object(Codelight\GDPR\Components\Consent\UserConsentModel)#1483 (3) { ["tableName"]=> string(15) "wc_gdpr_consent" ["version"]=> string(3) "1.0" ["primaryKey"]=> string(2) "id" } ["defaultConsentTypes":protected]=> array(1) { ["privacy-policy"]=> array(4) { ["slug"]=> string(14) "privacy-policy" ["title"]=> string(321) "Die Datenschutzrichtlinie habe ich gelesen und akzeptiere sie." ["description"]=> string(126) "This consent is not visible by default. If someone wishes to withdraw it, they should simply request to delete all their data." ["visible"]=> bool(false) } } ["customConsentTypes":protected]=> array(2) { ["umfrageacceptance"]=> array(4) { ["slug"]=> string(17) "umfrageacceptance" ["title"]=> string(54) "Umfrage." ["description"]=> string(107) "Umfrage eingewilligt" ["visible"]=> string(0) "" } ["faqacceptance"]=> array(4) { ["slug"]=> string(13) "faqacceptance" ["title"]=> string(32) "FAQ" ["description"]=> string(95) "FAQ eingewilligt" ["visible"]=> string(0) "" } } } ["consents":protected]=> array(0) { } ["dataRepository"]=> object(Codelight\GDPR\DataSubject\DataRepository)#10158 (1) { ["email"]=> string(19) "[email protected]" } } Array
same part, User with given privacy consent
["defaultConsentTypes":protected]=> array(1) { ["privacy-policy"]=> array(4) { ["slug"]=> string(14) "privacy-policy" ["title"]=> string(321) "Die Datenschutzrichtlinie habe ich gelesen und akzeptiere sie. " ["description"]=> string(126) "This consent is not visible by default. If someone wishes to withdraw it, they should simply request to delete all their data." ["visible"]=> bool(false) } }