Title: Reactivate cookies programmatically
Last modified: June 21, 2021

---

# Reactivate cookies programmatically

 *  Resolved [dhauradou](https://wordpress.org/support/users/dhauradou/)
 * (@dhauradou)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/reactivate-cookies-programmatically/)
 * Hello,
 * I am creating a private social media plaform. So 99% of my website require to
   be logged in and to have a profile page with some personal informations. The 
   only pages accessible to anyone are a landing page, some legal pages and a contact
   form.
 * I would like my users to consent to all cookies (like FB or Linkedin) when they
   register. So my question I guess is : How to reactivate (implicit user consent)
   all cookies and personnal shared data when the user is logging in ?
 * A logged-out user have to see the cookie banner and choose to consent or not,
   but when he is logging into the site, how can I reactivate all cookies automatically/
   programmatically if they have initially not given their consent (before registering
   or logging in) ?
 * Thank you !

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Contributor [Jarno Vos](https://wordpress.org/support/users/jarnovos/)
 * (@jarnovos)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/reactivate-cookies-programmatically/#post-14584151)
 * Hi [@dhauradou](https://wordpress.org/support/users/dhauradou/),
 * Aside from whether this would be GDPR-compliant, this should be possible to do.
 * You could check if the user is logged in, if this is false, tell Complianz that
   the site doesn’t need the cookiewarning/blocker. It would look something like
   this:
 * if (![is_user_logged_in()](https://developer.wordpress.org/reference/functions/is_user_logged_in/))
   
   return apply_filters(‘cmplz_site_needs_cookiewarning’, false);
 * Hope this helps.
    Kind regards, Jarno
 *  Plugin Contributor [Rogier Lankhorst](https://wordpress.org/support/users/rogierlankhorst/)
 * (@rogierlankhorst)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/reactivate-cookies-programmatically/#post-14585272)
 * The above is almost correct, but filter not used correctly:
 *     ```
       /**
        * Filter cookie warning required status
        * @param int $cookiewarning_required
        *
        * @return bool
        */
       function cmplz_my_filter_site_needs_cookiewarning( $cookiewarning_required
       ) {
   
       	//disable Complianz if user logged in
       	if ( is_user_logged_in() ) {
       		$cookiewarning_required = false;
       	}
   
       	return $cookiewarning_required;
       }
       add_filter( 'cmplz_site_needs_cookiewarning', 'cmplz_my_filter_site_needs_cookiewarning' );
       ```
   
 *  Thread Starter [dhauradou](https://wordpress.org/support/users/dhauradou/)
 * (@dhauradou)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/reactivate-cookies-programmatically/#post-14588037)
 * Hello [@jarnovos](https://wordpress.org/support/users/jarnovos/) [@rogierlankhorst](https://wordpress.org/support/users/rogierlankhorst/),
 * Thank you both so much for your replies.
 * The filter works great, I do not see the floating banner when I log in. When 
   logged in, on the cookie policy page generated by Complianz, I do not see the
   toggles for categorized cookies consent.
 * Does this mean that when logged-in the cookie notice is hidden and the last user
   consent is respected, or this means that the cookie notice is hidden and no cookie
   is blocked (cookie bloker is disabled I think) ?
 * If all cookies are blocked, this filter has the same action as cmplzAcceptAllCookies()
   in the JS side ?
 * Thank you for your time, have a great day!
 *  Plugin Contributor [Rogier Lankhorst](https://wordpress.org/support/users/rogierlankhorst/)
 * (@rogierlankhorst)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/reactivate-cookies-programmatically/#post-14588068)
 * [@dhauradou](https://wordpress.org/support/users/dhauradou/), Complianz is disabled
   completely, so the cookie blocker is disabled as well. All cookies will be placed
   by default.
 *  Thread Starter [dhauradou](https://wordpress.org/support/users/dhauradou/)
 * (@dhauradou)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/reactivate-cookies-programmatically/#post-14588454)
 * [@rogierlankhorst](https://wordpress.org/support/users/rogierlankhorst/) Thank
   for your fast reply, I’m happy with the filter, exactly what I needed.
 * Great plugin and great support.
 * Thank you.
 *  Plugin Contributor [Mathieu Paapst](https://wordpress.org/support/users/paapst/)
 * (@paapst)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/reactivate-cookies-programmatically/#post-14588778)
 * Hi [@dhauradou](https://wordpress.org/support/users/dhauradou/)
    Great to hear
   that your issue is resolved! Could you tell us what you think of the plugin or
   the support by casting [your Review here](https://wordpress.org/support/plugin/complianz-gdpr/reviews/#new-post)?
   We’d love to hear your feedback!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Reactivate cookies programmatically’ is closed to new replies.

 * ![](https://ps.w.org/complianz-gdpr/assets/icon-256x256.png?rev=2881064)
 * [Complianz - GDPR/CCPA Cookie Consent](https://wordpress.org/plugins/complianz-gdpr/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/complianz-gdpr/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/complianz-gdpr/)
 * [Active Topics](https://wordpress.org/support/plugin/complianz-gdpr/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/complianz-gdpr/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/complianz-gdpr/reviews/)

 * 6 replies
 * 4 participants
 * Last reply from: [Mathieu Paapst](https://wordpress.org/support/users/paapst/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/reactivate-cookies-programmatically/#post-14588778)
 * Status: resolved