Luka Soldo
Luka Soldo

Reputation: 1

How to add GDPR accept privacy checkbox before submiting post on forum

first i have to say BIG respect for all of you that tries to help

I'm not programer..i have almost zero coding experience,its slim to none i know it might not be smart but i decide to open web shop wordpress (e-commerce - woocomerce) because i already have shop in real life i manage to connected everything and after few months of strugle and watching hundreds of tutorials i achieve to get everything on my site that i was looking for (backend is on 95% and front-end is on 70% finished - but i will finish it soon because only easy part left)

I am from Croatia and my site is for Croatians,because Croatia is in Europe website must follow GDPR i manage to get everything done (cookie banner, cookie info, privacy policy, contact, delete accounts..checkboxes of consent...and all other things) but now i'm stuck with one issue that i can't resolve..i'm using Asgaros FREE plugin/addon for forum but there is no checkbox for user to accept privacy (GDPR consent) before submiting posts..can anyone help me with code how to add checkbox that is required before users submits post on Asgaros forum

I used snipped code (PHP) to add checkbox on registration and its working but i don't know how to achieve that on forum

Code that i used for registration that is working

add_action( 'woocommerce_register_form', 'wtwh_add_registration_privacy_policy', 11 );
   
function wtwh_add_registration_privacy_policy() {
 
woocommerce_form_field( 'privacy_policy_reg', array(
   'type'          => 'checkbox',
   'class'         => array('form-row privacy'),
   'label_class'   => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'),
   'input_class'   => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'),
   'required'      => true,
   'label'         => 'I've read rules and i accept <a href="/privacy-policy">privacy policy</a>',
));
  
}
  
// Show error if user does not tick
   
add_filter( 'woocommerce_registration_errors', 'wtwh_validate_privacy_registration', 10, 3 );
  
function wtwh_validate_privacy_registration( $errors, $username, $email ) {
if ( ! is_checkout() ) {
    if ( ! (int) isset( $_POST['privacy_policy_reg'] ) ) {
        $errors->add( 'privacy_policy_reg_error', __( 'Please read our privacy policy and accept terms!', 'woocommerce' ) );
    }
}
return $errors;
}

That worked for register, but can't find way how to add checkbox like that on asgaros forum (before submiting post or topic)

I would REALLY appreciate if anyone can help me..i really trying to make my site fully GDPR compliant and i manage to do all steps except this one, this is last thing thats left to do

Here is list of all Asgaros hooks (Actions & Filters) https://github.com/Asgaros/asgaros-forum/blob/master/hooks.md

I tried experimenting for days to get it done, tried many different PHP codes, even tried code that ChatGPT4 gave me but neither one worked..so i decide to do backup (just in case) and then i joined stackkoverflow to ask for help, i'm hoping someone will be able to help me..i will reward frist one who provide me PHP code that is gonna help me to resolve the issue..i really need your help

Upvotes: 0

Views: 90

Answers (0)

Related Questions