Skip to content

Tkgdpr 36 reset data#265

Open
moutushi82 wants to merge 7 commits intodevelopfrom
TKGDPR-36-Reset-Data
Open

Tkgdpr 36 reset data#265
moutushi82 wants to merge 7 commits intodevelopfrom
TKGDPR-36-Reset-Data

Conversation

@moutushi82
Copy link
Contributor

No description provided.

@moutushi82 moutushi82 requested a review from fclaussen May 21, 2020 20:30
update_option( 'gdpr_consent_types', '' );
update_option( 'gdpr_privacy_bar_position', 'bottom' );

GDPR_Audit_Log::log( $user->ID, sprintf( esc_html__( 'Plugin data reset on %1$s.', 'gdpr' ), date( 'm/d/Y' ) ) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rephrase this to "Plugin Settings were reset on %1$s"

<?php
echo sprintf(
/* translators: External link with instructions on how to proceed. */
esc_html__( 'To reset plugin data please click %s.', 'gdpr' ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"To reset these settings, please click %s"

* @since 1.0.0
* @author Moutushi Mandal <moutushi82@gmail.com>
*/
public function reset_plugin_data() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rename to reset_plugin_settings

add_action( 'admin_post_gdpr_mark_resolved', array( $requests_admin, 'mark_resolved' ) );
add_action( 'wp_ajax_gdpr_anonymize_comments', array( $requests_admin, 'anonymize_comments' ) );
add_action( 'wp_ajax_gdpr_reassign_content', array( $requests_admin, 'reassign_content' ) );
add_action( 'wp_ajax_gdpr_reset_plugin_data', array( $requests_admin, 'reset_plugin_data' ) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the new function name

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and it should also bee wp_ajax_gdpr_reset_plugin_settings

);
} );

$( document ).on( 'click', '.gdpr-reset-data', function( e ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.gdpr-reset-settings

$.post(
ajaxurl,
{
action: 'gdpr_reset_plugin_data',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gdpr_reset_plugin_settings

nonce: nonce
},
function( res ) {
alert( 'All data deleted successfully!' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All settings deleted successfully!

This also needs to be translatable.

}
}

.gdpr-reset-data {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.gdpr-reset-settings

* @author Moutushi Mandal <moutushi82@gmail.com>
*/
public function reset_plugin_data() {
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['nonce'] ) ), 'gdpr_reset_data' ) ) { // phpcs:ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gdpr_reset_settings

echo sprintf(
/* translators: External link with instructions on how to proceed. */
esc_html__( 'To reset plugin data please click %s.', 'gdpr' ),
'<a href="#" class="gdpr-reset-data" data-nonce="' . esc_attr( wp_create_nonce( 'gdpr_reset_data' ) ) .'">' . esc_html__( 'here', 'gdpr' ) . '</a>'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gdpr-reset-settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants