| Server IP : 68.183.124.220 / Your IP : 216.73.217.137 Web Server : Apache/2.4.18 (Ubuntu) System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : gavin ( 1000) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/wp-content/plugins/ninja-forms/includes/Actions/ |
Upload File : |
<?php if ( ! defined( 'ABSPATH' ) ) exit;
/**
* Class NF_Actions_DataRemoval
*/
final class NF_Actions_DeleteDataRequest extends NF_Abstracts_Action
{
/**
* @var string
*/
protected $_name = 'deletedatarequest';
/**
* @var array
*/
protected $_tags = array();
/**
* @var string
*/
protected $_timing = 'late';
/**
* @var int
*/
protected $_priority = 10;
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->_nicename = __( 'Delete Data Request', 'ninja-forms' );
$settings = Ninja_Forms::config( 'ActionDeleteDataRequestSettings' );
$this->_settings = array_merge( $this->_settings, $settings );
}
/*
* PUBLIC METHODS
*/
public function save( $action_settings )
{
}
/**
* Creates a Erase Personal Data request for the user with the email
* provided
*
* @param $action_settings
* @param $form_id
* @param $data
*
* @return array
*/
public function process( $action_settings, $form_id, $data )
{
$data = array();
if( isset( $data['settings']['is_preview'] ) && $data['settings']['is_preview'] ){
return $data;
}
// get the email setting
$email = $action_settings[ 'email' ];
// create request for user
$request_id = wp_create_user_request( $email,
'remove_personal_data' );
/**
* Basically ignore if we get a user error as it will be one of two
* things.
*
* 1) The email in question is already in the erase data request queue
* 2) The email does not belong to an actual user.
*/
if( ! $request_id instanceof WP_Error ) {
// send the request if it's not an error.
// to anonymize or not to anonymize, that is the question
add_post_meta( $request_id,
'nf_anonymize_data',
$action_settings[ 'anonymize' ] );
wp_send_user_request( $request_id );
}
return $data;
}
}