• Resolved zittercraft

    (@zittercraft)


    Hi, the latest update broke the following customization code for the Privacy Tools Page on the frontend:

    <?php
    $controller = gdpr(Codelight\GDPR\Components\PrivacyToolsPage\PrivacyToolsPageController::class);
    remove_action('gdpr/frontend/privacy-tools-page/content', [$controller, 'renderConsentForm'], 10);

    Result:
    Unknown name in gdpr: Codelight\GDPR\Components\PrivacyToolsPage\PrivacyToolsPageController

    Could you check this, please?

    Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Can you tell us a little more about the circumstances surrounding this error?

    If this happened during the update to 2.0.0, a deactivate, followed by an activate of the plugin should resolve this issue.

    If this doesn’t resolve the problem, it’s possible that stale code from the browser cache might be causing this. In that case, clearing the browser cache will fix the problem.

    Please let us know if this helps.

    I see the issue now. You will want to replace the code with something like this. You might have to make some namespace changes to get this to work.

    
    <?php
    global $gdpr;
    $controller = new Codelight\GDPR\Components\PrivacyToolsPage\PrivacyToolsPageController(
                $gdpr->DataSubjectAuthenticator
                , $gdpr->DataSubjectIdentificator
                , $gdpr->DataSubject
                , $gdpr->DataExporter
                , $gdpr->UserConsentModel
                );
    remove_action('gdpr/frontend/privacy-tools-page/content', [$controller, 'renderConsentForm'], 10);
    
    Thread Starter zittercraft

    (@zittercraft)

    Hi, thanks for the fast response, very appreciated.

    It kinda works but not sufficient ?? now the content of the Privacy Tools Page is duplicated. Without the “remove action”-part each form (Consent, Export, Delete) is generated twice. The “remove action”-snippet prevents only one of the respective forms, so for the example above I get
    – Consent
    – Export
    – Export
    – Delete
    – Delete

    I use a workaround so I’m fine for the moment: I’ve overridden the unwantend templates with an empty file in my child theme. But of course it would be helpful to resolve the problem in the first place.

    To your first questions: Yes, the error happened during the 2.0.0 update. And no, deactivate/activate or clearing the cache (browser or server) didn’t help.

    In your custom code example, you remove the call to renderConsentForm. Have you also removed the calls to renderExportForm and renderDeleteForm?

    If you haven’t. You can remove those other two by these calls:

    
    remove_action('gdpr/frontend/privacy-tools-page/content', [$controller, 'renderExportForm'], 20);
    remove_action('gdpr/frontend/privacy-tools-page/content', [$controller, 'renderDeleteForm'], 30);
    
    
    Thread Starter zittercraft

    (@zittercraft)

    No, that’s not the issue. Your fix duplicates the forms on the Privacy Tools Page, so without removing any call I see:

    – Consent Form
    – Consent Form
    – Export Form
    – Export Form
    – Delete Form
    – Delete Form

    When I remove the call to renderConsentForm, it prevents only one of the two consent forms, the other one appears (same with renderExportForm or renderDeleteForm). A matter of double query, I guess?

    I need more information. You’re customizing the tools page but beyond that I need to be able to see the code and page results.

    Can you provide code that would enable me to reproduce the problem you are seeing?

    Thread Starter zittercraft

    (@zittercraft)

    Well, I can reproduce the error on the fly ??

    – I just create a fresh WordPress Site
    – install Code Snippets Plugin + The GDPR framework Plugin
    – add a page for the Privacy Tools Page
    – add the shortcode [gdpr_privacy_tools]
    – add the following code via Code Snippet

    global $gdpr;
    $controller = new Codelight\GDPR\Components\PrivacyToolsPage\PrivacyToolsPageController(
                $gdpr->DataSubjectAuthenticator
                , $gdpr->DataSubjectIdentificator
                , $gdpr->DataSubject
                , $gdpr->DataExporter
                , $gdpr->UserConsentModel
                );
    remove_action('gdpr/frontend/privacy-tools-page/content', [$controller, 'renderExportForm'], 20);
    

    Same issue: 1x Export Form but 2x Delete Form
    (in this case, no consents are given, so I concentrated on the Export Form)

    I can give you admin rights to this test site but it’s really nothing special to it. How can I reach you?

    I don’t understand the purpose of the call to PrivacyToolsController(). It merely duplicates what the [gdpr_privacy_tools] short code already does. Which explains why you need to do all 3 remove_action calls.

    If you will use the entire section of code below, there will be no duplicates.

    
    global $gdpr;
    $controller = new Codelight\GDPR\Components\PrivacyToolsPage\PrivacyToolsPageController(
                $gdpr->DataSubjectAuthenticator
                , $gdpr->DataSubjectIdentificator
                , $gdpr->DataSubject
                , $gdpr->DataExporter
                , $gdpr->UserConsentModel
                );
    remove_action('gdpr/frontend/privacy-tools-page/content', [$controller, 'renderConsentForm'], 10);
    remove_action('gdpr/frontend/privacy-tools-page/content', [$controller, 'renderExportForm'], 20);
    remove_action('gdpr/frontend/privacy-tools-page/content', [$controller, 'renderDeleteForm'], 30);
    

    You can contact me through our support portal: https://data443.atlassian.net/servicedesk/customer/portal/2/group/6/create/148

    Thread Starter zittercraft

    (@zittercraft)

    I followed the instructions in your Developer Docs – seems to be outdated?
    https://data443.atlassian.net/servicedesk/customer/portal/2/article/2082439194

    Privacy Tool Page
    “To remove something, you can fetch the PrivacyToolsPageController object and remove the action like this:

    <?php
    $controller = gdpr(Codelight\GDPR\Components\PrivacyToolsPage\PrivacyToolsPageController::class);
    remove_action('gdpr/frontend/privacy-tools-page/content', [$controller, 'renderConsentForm'], 10);

    Until version 2.0.0 everything worked just fine, no duplicates. The update broke that code, see the error I mentioned at the start of the thread.

    I’ve send you some login data via your support portal.

    Thanks for checking!

    Thank for the explanation. That helped me to understand the problem. We will need to update the developer docs. We will also fix the plugin to continue supporting this feature.

    @zittercraft ,
    Version 2.0.1 has just been released and the developer docs updated.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Remove Consent Form from Privacy Tools Page Frontend broken’ is closed to new replies.