Skip to content

Functions & Shortcodes

Fernando Claussen edited this page May 8, 2020 · 1 revision

Functions

Function Description Language
GDPR::save_consent( $user_id, $consent_id ) Save a user consent to the database PHP
GDPR::remove_consent( $user_id, $consent_id ) Remove a user consent from the database PHP
GDPR::consent_checkboxes() Print a set of checkboxes for all registered consent options PHP
GDPR::get_consent_checkboxes() Return a set of checkboxes for all registered consent options PHP
GDPR::save_user_consent_on_registration( $user_id ) Saves all the checked consent options to the user database and logs the registration to the audit log. This should be used in conjunction with GDPR::consent_checkboxes(). This functions should be called right after the user has been saved to the database PHP
has_consent( $consent_id ) Checks if a user has given a specific consent. Works for logged in users or visitors PHP, JS
is_allowed_cookie( $cookie ) Checks if a cookie is allowed or not. Works for logged in users or visitors PHP, JS
gdpr_request_form( $type ) Renders one of the request forms. Possible types are: delete, rectify, complaint or export-data PHP
gdpr_preferences( $text ) Renders a button that opens the privacy preference center PHP

Shortcodes

Shortcode Description
[gdpr_preferences text="Privacy Preferences"] Renders a button that opens the privacy preference center. The text attribute is optional. By default, it is “Privacy Policy”
[gdpr_request_form type="delete"] Renders the user deletion request form
[gdpr_request_form type="rectify"] Renders the data rectification request form
[gdpr_request_form type="complaint"] Renders the complaint form
[gdpr_request_form type="export-data"] Renders the user data export request form