• Resolved huubl

    (@huubl)


    Hi,

    I try to use the filter “cmplz_document_elements” and change the output of the elements in /plugins/complianz-gdpr/config/class-config.php:455.

    But the filter doesn’t seem to work, how to use this filter?

    add_filter('cmplz_document_elements', __NAMESPACE__ . '\\mod_cmplz_dynamic_document_elements', 99, 4);
    function mod_cmplz_dynamic_document_elements($elements, $region, $type, $fields)
    {
        error_log(print_r($elements, true));
    
        return $elements;
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Jarno Vos

    (@jarnovos)

    Hi @huubl,

    This filter is only applicable to the Pro plugin.

    Depending on the exact use case, you might be interested in the following article which explains how you can edit the document content manually: https://complianz.io/editing-legal-documents/

    Kind regards, Jarno

    • This reply was modified 2 years, 3 months ago by Jarno Vos.
    Thread Starter huubl

    (@huubl)

    Hi @jarnovos,

    I want to replace all contents below “What is a web beacon?”.

    What I understand there are 2 ways in the free plugin:

    • disabling synchronization
    • with str_replace using the ‘cmplz_document_html’ filter

    I rather use synchronization, but the str_replace method seems not reliable since the input can change.

    With the pro version, can I use ‘cmplz_document_elements’ to override content?

    Plugin Contributor Jarno Vos

    (@jarnovos)

    Hi @huubl,

    We recommend using the cmplz_document_html filter (https://complianz.io/changing-the-text-in-your-legal-documents/) for such purposes.

    Although if you require many textual changes, the best way would probably be to unsync & edit (https://complianz.io/editing-legal-documents/).

    Kind regards, Jarno

    Thread Starter huubl

    (@huubl)

    Hi @jarnovos,

    I’m going to unsync the document for the time being.

    However, I’ve noticed that the ‘cmplz_document_elements’ filter is working (in the free plugin) when used in a MU-plugin. This filter could potentially simplify the customization of policy sections, don’t you think? Especially if all document elements in the array have named keys, like ‘contact-details-2’ for example:

    function mod_cmplz_dynamic_document_elements($elements, $region, $type, $fields)
    {
        if (isset($elements['contact-details-2']['content'])) {
            $elements['contact-details-2']['content'] = 'override contact details HTML';
        }
    
        return $elements;
    }
    add_filter('cmplz_document_elements', __NAMESPACE__ . '\\mod_cmplz_dynamic_document_elements', 99, 4);
    • This reply was modified 2 years, 3 months ago by huubl.
    Plugin Contributor Jarno Vos

    (@jarnovos)

    Hi @huubl,

    Yeah, I can see how this would be useful. For the time being I would indeed recommend the ‘unsync and edit’ method, but I’ll raise the suggestion for consideration in a future release.

    Kind regards, Jarno

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

The topic ‘Filter “cmplz_document_elements” not working’ is closed to new replies.