Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/ninja-fo.../includes/Actions
File: DeleteDataRequest.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Class NF_Actions_DataRemoval
[3] Fix | Delete
*/
[4] Fix | Delete
final class NF_Actions_DeleteDataRequest extends NF_Abstracts_Action
[5] Fix | Delete
{
[6] Fix | Delete
/**
[7] Fix | Delete
* @var string
[8] Fix | Delete
*/
[9] Fix | Delete
protected $_name = 'deletedatarequest';
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* @var array
[13] Fix | Delete
*/
[14] Fix | Delete
protected $_tags = array();
[15] Fix | Delete
[16] Fix | Delete
/**
[17] Fix | Delete
* @var string
[18] Fix | Delete
*/
[19] Fix | Delete
protected $_timing = 'late';
[20] Fix | Delete
[21] Fix | Delete
/**
[22] Fix | Delete
* @var int
[23] Fix | Delete
*/
[24] Fix | Delete
protected $_priority = 10;
[25] Fix | Delete
[26] Fix | Delete
/**
[27] Fix | Delete
* Constructor
[28] Fix | Delete
*/
[29] Fix | Delete
public function __construct()
[30] Fix | Delete
{
[31] Fix | Delete
parent::__construct();
[32] Fix | Delete
[33] Fix | Delete
$this->_nicename = esc_html__( 'Delete Data Request', 'ninja-forms' );
[34] Fix | Delete
[35] Fix | Delete
$settings = Ninja_Forms::config( 'ActionDeleteDataRequestSettings' );
[36] Fix | Delete
$this->_settings = array_merge( $this->_settings, $settings );
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
/*
[40] Fix | Delete
* PUBLIC METHODS
[41] Fix | Delete
*/
[42] Fix | Delete
[43] Fix | Delete
public function save( $action_settings )
[44] Fix | Delete
{
[45] Fix | Delete
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* Creates a Erase Personal Data request for the user with the email
[50] Fix | Delete
* provided
[51] Fix | Delete
*
[52] Fix | Delete
* @param $action_settings
[53] Fix | Delete
* @param $form_id
[54] Fix | Delete
* @param $data
[55] Fix | Delete
*
[56] Fix | Delete
* @return array
[57] Fix | Delete
*/
[58] Fix | Delete
public function process( $action_settings, $form_id, $data )
[59] Fix | Delete
{
[60] Fix | Delete
$data = array();
[61] Fix | Delete
[62] Fix | Delete
if( isset( $data['settings']['is_preview'] ) && $data['settings']['is_preview'] ){
[63] Fix | Delete
return $data;
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
// get the email setting
[67] Fix | Delete
$email = $action_settings[ 'email' ];
[68] Fix | Delete
[69] Fix | Delete
// create request for user
[70] Fix | Delete
$request_id = wp_create_user_request( $email,
[71] Fix | Delete
'remove_personal_data' );
[72] Fix | Delete
[73] Fix | Delete
/**
[74] Fix | Delete
* Basically ignore if we get a user error as it will be one of two
[75] Fix | Delete
* things.
[76] Fix | Delete
*
[77] Fix | Delete
* 1) The email in question is already in the erase data request queue
[78] Fix | Delete
* 2) The email does not belong to an actual user.
[79] Fix | Delete
*/
[80] Fix | Delete
if( ! $request_id instanceof WP_Error ) {
[81] Fix | Delete
// send the request if it's not an error.
[82] Fix | Delete
[83] Fix | Delete
// to anonymize or not to anonymize, that is the question
[84] Fix | Delete
add_post_meta( $request_id,
[85] Fix | Delete
'nf_anonymize_data',
[86] Fix | Delete
$action_settings[ 'anonymize' ] );
[87] Fix | Delete
[88] Fix | Delete
wp_send_user_request( $request_id );
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
return $data;
[92] Fix | Delete
}
[93] Fix | Delete
}
[94] Fix | Delete
[95] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function