GDPR CCPA Compliance Support Shortcodes

Below, you’ll find a detailed guide on how to add the GDPR CCPA Compliance Support Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the GDPR CCPA Compliance Support Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the GDPR CCPA Compliance Support Plugin and the shortcodes it provides:

Plugin Icon
GDPR CCPA Compliance Support

"GDPR CCPA Compliance Support is a WordPress plugin designed to help your website adhere to important privacy regulations. This ninja-gdpr-compliance plugin is a must for online businesses."

★★★★★ (6) Active Installs: 3000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [njt_gdpr_data_access]
  • [njt_gdpr_data_rectification]
  • [njt_gdpr_forgetme]
  • [njt_gdpr_policy]
  • [njt_gdpr_privacy_settings]
  • [njt_gdpr_term]

GDPR CCPA Compliance Support [njt_gdpr_data_access] Shortcode

The Ninja GDPR Compliance plugin shortcode, ‘njt_gdpr_data_access’, creates a form for users to request their personal data. This form includes an email field and a submit button. Upon submission, a data access request is sent.

Shortcode: [njt_gdpr_data_access]

Examples and Usage

Basic example – A simple usage of the shortcode to display a GDPR data access form.

[njt_gdpr_data_access /]

PHP Function Code

In case you have difficulties debugging what causing issues with [njt_gdpr_data_access] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('njt_gdpr_data_access', array($this, 'shortcodeDataAccess'));

Shortcode PHP function:

                    function shortcodeDataAccess($atts)
    {
        ob_start();
        ?>
        <form action="" method="POST" class="njt_gdpr_dataaccess_form">
            <p>
                <label for="njt_gdpr_dataaccess_form_email"><?php _e('Email', NJT_GDPR_I18N); ?></label>
                <input type="text" name="email" id="njt_gdpr_dataaccess_form_email" class="njt_gdpr_dataaccess_form_email" value="" required />
            </p>
            <p>
                <button type="button" class="njt_gdpr_btn njt_gdpr_dataaccess_btn">
                    <?php _e('Submit', NJT_GDPR_I18N); ?>
                </button>
            </p>
        </form>
        <?php
        return ob_get_clean();
    }
                    

Code file location:

ninja-gdpr-compliance/ninja-gdpr-compliance/src/DataAccess.php

GDPR CCPA Compliance Support [njt_gdpr_data_rectification] Shortcode

The Ninja GDPR Compliance plugin shortcode ‘njt_gdpr_data_rectification’ is designed to create a form for users to rectify their data. This shortcode generates a form with fields for the user’s email, old information, and new information. It also includes a submit button. If the user is logged in, their email will be pre-filled and read-only. The form allows users to update their existing data in compliance with GDPR regulations.

Shortcode: [njt_gdpr_data_rectification]

Parameters

Here is a list of all possible njt_gdpr_data_rectification shortcode parameters and attributes:

  • email_text – Defines the placeholder text for the email field in the form.
  • old_information_text – Sets the label for the field where users enter their current information.
  • new_information_text – Sets the label for the field where users enter their corrected information.
  • btn_text – Specifies the text on the submit button of the form.

Examples and Usage

Basic example – A shortcode to display a data rectification form with default values for the email, old information, new information, and submit button text.

[njt_gdpr_data_rectification /]

Advanced examples

Using the shortcode to display a data rectification form with custom values for the email, old information, new information, and submit button text.

[njt_gdpr_data_rectification email_text="Your Email Address" old_information_text="Current Information" new_information_text="Updated Information" btn_text="Send Request" /]

Using the shortcode to display a data rectification form with a custom value for the submit button text, while keeping the default values for the email, old information, and new information.

[njt_gdpr_data_rectification btn_text="Send Request" /]

Using the shortcode to display a data rectification form with custom values for the old information and new information, while keeping the default values for the email and submit button text.

[njt_gdpr_data_rectification old_information_text="Current Information" new_information_text="Updated Information" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [njt_gdpr_data_rectification] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('njt_gdpr_data_rectification', array($this, 'shortcodeData'));

Shortcode PHP function:

                    function shortcodeData($atts)
    {
        $atts = shortcode_atts( array(
            'email_text' => __('Your Email', NJT_GDPR_I18N),
            'old_information_text' => __('Enter your information as it currently exists in our system', NJT_GDPR_I18N),
            'new_information_text' => __('Enter the correct version of your information', NJT_GDPR_I18N),
            'btn_text' => __('Submit', NJT_GDPR_I18N),
        ), $atts, 'njt_gdpr_data_rectification' );

        $email = '';
        $current_user = wp_get_current_user();
        if ($current_user->ID != 0) {
            $email = $current_user->user_email;
        }
        ob_start();
        ?>
        <form action="" method="POST" class="njt_gdpr_data_rectification_form">
            <p>
                <label for="njt_gdpr_data_rectification_form_email"><?php echo esc_html($atts['email_text']); ?></label>
                <input type="text" name="email" id="njt_gdpr_data_rectification_form_email" class="njt_gdpr_data_rectification_form_email" value="<?php echo esc_attr($email); ?>" required <?php echo ((!empty($email)) ? 'readonly' : ''); ?> />
            </p>
            <p>
                <label for="your-old-information"><?php echo esc_html($atts['old_information_text']); ?></label>
                <textarea name="your-old-information" id="your-old-information" cols="30" rows="10" required></textarea>
            </p>
            <p>
                <label for="your-new-information"><?php echo esc_html($atts['new_information_text']); ?></label>
                <textarea name="your-new-information" id="your-new-information" cols="30" rows="10" required></textarea>
            </p>
            <p>
                <button type="button" class="njt_gdpr_data_rectification_btn"><?php echo esc_html($atts['btn_text']); ?></button>
            </p>
        </form>
        <?php
        return ob_get_clean();
    }
                    

Code file location:

ninja-gdpr-compliance/ninja-gdpr-compliance/src/DataRectification.php

GDPR CCPA Compliance Support [njt_gdpr_forgetme] Shortcode

The Ninja GDPR Compliance plugin shortcode, ‘njt_gdpr_forgetme’, creates a form for users to submit their email for data deletion requests. This form includes an email input field and a submit button. The form’s design can be customized using CSS. It aids in GDPR compliance by facilitating data erasure requests.

Shortcode: [njt_gdpr_forgetme]

Examples and Usage

Basic example – Presents a form that allows users to submit their email and request for their data to be forgotten in compliance with GDPR regulations.

[njt_gdpr_forgetme /]

PHP Function Code

In case you have difficulties debugging what causing issues with [njt_gdpr_forgetme] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('njt_gdpr_forgetme', array($this, 'shortcodeForgetMe'));

Shortcode PHP function:

                    function shortcodeForgetMe($atts)
    {
        ob_start();
        ?>
        <form action="" method="POST" class="njt_gdpr_forget_me_form">
            <p>
                <label for="njt_gdpr_forget_me_form_email"><?php _e('Email', NJT_GDPR_I18N); ?></label>
                <input type="text" name="email" id="njt_gdpr_forget_me_form_email" class="njt_gdpr_forget_me_form_email" value="" required />
            </p>
            <p>
                <button type="button" class="njt_gdpr_forget_me_btn"><?php _e('Submit', NJT_GDPR_I18N); ?></button>
            </p>
        </form>
        <?php
        return ob_get_clean();
    }
                    

Code file location:

ninja-gdpr-compliance/ninja-gdpr-compliance/src/ForgetMe.php

GDPR CCPA Compliance Support [njt_gdpr_policy] Shortcode

The Ninja GDPR Compliance plugin shortcode `njt_gdpr_policy` is used to create a GDPR policy acceptance form. This shortcode generates a form with either an ‘Accept’ or ‘Decline’ button, depending on the user’s current GDPR policy acceptance status. If the policy is already accepted, the form displays a message with the accepted text and a ‘Decline’ button. If not, an ‘Accept’ button is shown.

Shortcode: [njt_gdpr_policy]

Examples and Usage

Basic Example – The shortcode ‘njt_gdpr_policy’ is used to display a GDPR compliance form. It does not require any parameters or attributes.

[njt_gdpr_policy /]

Advanced Examples

Since the shortcode ‘njt_gdpr_policy’ does not accept any parameters or attributes, there’s no advanced usage for this specific shortcode. However, you can always combine it with other shortcodes or WordPress functions to achieve more complex functionality.

For example, you can use it with the ‘do_shortcode’ function to execute the shortcode within a PHP file:


<?php echo do_shortcode('[njt_gdpr_policy /]'); ?>

Or, you can combine it with conditional tags to display the GDPR compliance form only on specific pages or posts:


<?php 
if(is_page('privacy-policy')) {
    echo do_shortcode('[njt_gdpr_policy /]'); 
} ?>

Remember, the possibilities are endless when you start combining different WordPress features and functions!

PHP Function Code

In case you have difficulties debugging what causing issues with [njt_gdpr_policy] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('njt_gdpr_policy', array($this, 'shortcodePolicy'));

Shortcode PHP function:

                    function shortcodePolicy($atts)
    {
        ob_start();
        $atts = shortcode_atts(array(), $atts, 'njt_gdpr_policy');
        $settings = $this->getSettings();
        echo '<form action="" method="POST">';
        if ($this->isAcceptedPolicy()) {
            echo '<p>'.esc_html($settings['accepted_text']).'</p>';
            echo '<button type="button" class="njt_gdpr_policy_decline_btn">'.esc_html(__('Decline', NJT_GDPR_I18N)).'</button>';
        } else {
            echo '<button type="button" class="njt_gdpr_policy_accept_btn">'.esc_html(__('Accept', NJT_GDPR_I18N)).'</button>';
        }
        echo '</form>';
        return ob_get_clean();
    }
                    

Code file location:

ninja-gdpr-compliance/ninja-gdpr-compliance/src/Policy.php

GDPR CCPA Compliance Support [njt_gdpr_privacy_settings] Shortcode

The Ninja GDPR Compliance shortcode is a powerful tool for managing user privacy settings. It creates a form where users can enable or disable cookies, Facebook Pixel, and Google Analytics. The PHP code associated with this shortcode generates a table with the names and descriptions of these options, and checkboxes for users to toggle their permissions. It also includes a ‘Save Changes’ button which triggers an AJAX request to save the user’s preferences. Shortcode: [njt_gdpr_privacy_settings]

Shortcode: [njt_gdpr_privacy_settings]

Examples and Usage

Basic example – Display the GDPR privacy settings form on any page or post.

[njt_gdpr_privacy_settings /]

PHP Function Code

In case you have difficulties debugging what causing issues with [njt_gdpr_privacy_settings] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('njt_gdpr_privacy_settings', array($this, 'privacySettingsPageShortcode'));

Shortcode PHP function:

                    function privacySettingsPageShortcode()
    {
        ob_start();
        $permission = njt_gdpr_get_permission();
        $settings = $this->getSettings();
        ?>
        <form action="" method="POST" class="njt-gdpr-privacy-settings-frm">
            <table>
                <thead>
                    <tr>
                        <th><?php _e('Name', NJT_GDPR_I18N); ?></th>
                        <th><?php _e('Description', NJT_GDPR_I18N); ?></th>
                        <th><?php _e('Enable ?', NJT_GDPR_I18N); ?></th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td><?php _e('Cookie', NJT_GDPR_I18N); ?></td>
                        <td><?php echo esc_html($settings['cookie_des']); ?></td>
                        <td><input type="checkbox" name="s[]" value="cookie" <?php checked($permission['cookie'], '1'); ?> /></td>
                    </tr>
                    <tr>
                        <td><?php _e('Facebook Pixel', NJT_GDPR_I18N); ?></td>
                        <td><?php echo esc_html($settings['fb_des']); ?></td>
                        <td><input type="checkbox" name="s[]" value="fb" <?php checked($permission['fb'], '1'); ?> /></td>
                    </tr>
                    <tr>
                        <td><?php _e('Google Analytics', NJT_GDPR_I18N); ?></td>
                        <td><?php echo esc_html($settings['gg_des']); ?></td>
                        <td><input type="checkbox" name="s[]" value="gg" <?php checked($permission['gg'], '1'); ?> /></td>
                    </tr>
                </tbody>
            </table>
            <button type="button" class="njt-gdpr-privacy-settings-btn"><?php _e('Save Changes', NJT_GDPR_I18N); ?></button>
        </form>
        <script type="text/javascript">
            jQuery(document).ready(function($) {
                $('.njt-gdpr-privacy-settings-btn').on('click', function(event) {
                    var frm = $(this).closest('form');
                    var s = [];
                    $.each(frm.find('input[name^="s"]'), function(index, el) {
                        if ($(el).prop('checked')) {
                            s.push($(el).val());
                        }
                    });
                    $.ajax({
                        url: '<?php echo admin_url('admin-ajax.php'); ?>',
                        type: 'POST',
                        data: {
                            action: 'njt_gdpr_save_privacy_settings',
                            s: s
                        },
                    })
                    .done(function(json) {
                        if (json.success) {
                            alert('Success');
                            location.reload();
                        } else {
                            alert(json.data.mess);
                        }
                    })
                    .fail(function() {
                        alert('<?php _e('Please refresh and try again.', NJT_GDPR_I18N); ?>');
                    });
                    return false;
                });
            });
        </script>
        <?php
        return ob_get_clean();
    }
                    

Code file location:

ninja-gdpr-compliance/ninja-gdpr-compliance/src/PrivacySettingsPage.php

GDPR CCPA Compliance Support [njt_gdpr_term] Shortcode

The Ninja GDPR Compliance Plugin shortcode, ‘njt_gdpr_term’, is designed to create an acceptance form for website terms. This shortcode outputs a form with either an ‘Accept’ or ‘Decline’ button, depending on whether the user has previously accepted the website’s terms.

Shortcode: [njt_gdpr_term]

Examples and Usage

Basic example – A straightforward usage of the ninja-gdpr-compliance plugin shortcode. This will display an ‘Accept’ or ‘Decline’ button based on the GDPR terms acceptance status.

[njt_gdpr_term /]

PHP Function Code

In case you have difficulties debugging what causing issues with [njt_gdpr_term] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('njt_gdpr_term', array($this, 'shortcodeTerm'));

Shortcode PHP function:

                    function shortcodeTerm($atts)
    {
        ob_start();
        $atts = shortcode_atts(array(), $atts, 'njt_gdpr_term');
        echo '<form action="" method="POST">';
        if ($this->isAcceptedTerm()) {
            echo '<button type="button" class="njt_gdpr_term_decline_btn">'.esc_html(__('Decline', NJT_GDPR_I18N)).'</button>';
        } else {
            echo '<button type="button" class="njt_gdpr_term_accept_btn">'.esc_html(__('Accept', NJT_GDPR_I18N)).'</button>';
        }
        echo '</form>';
        return ob_get_clean();
    }
                    

Code file location:

ninja-gdpr-compliance/ninja-gdpr-compliance/src/Term.php

Conclusion

Now that you’ve learned how to embed the GDPR CCPA Compliance Support Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *