• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Akismet_Admin::erase_personal_data() – When a user requests that their personal data be removed, Akismet has a duty to discard any personal data we store outside of the comment itself. Right now, that is limited to the copy of the comment we store in the akismet_as_submitted commentmeta.

You appear to be a bot. Output may be restricted

Description

When a user requests that their personal data be removed, Akismet has a duty to discard any personal data we store outside of the comment itself. Right now, that is limited to the copy of the comment we store in the akismet_as_submitted commentmeta.

FWIW, this information would be automatically deleted after 15 days.

Usage

$array = Akismet_Admin::erase_personal_data( $email_address, $page );

Parameters

$email_address
( mixed ) required –
$page
( mixed ) optional default: 1 –

Returns

array

Source

File name: akismet/class.akismet-admin.php
Lines:

1 to 35 of 35
  public static function erase_personal_data( $email_address, $page = 1 ) {
    $items_removed = false;
    
    $number = 50;
    $page = (int) $page;

    $comments = get_comments(
      array(
        'author_email' => $email_address,
        'number'       => $number,
        'paged'        => $page,
        'order_by'     => 'comment_ID',
        'order'        => 'ASC',
      )
    );

    foreach ( (array) $comments as $comment ) {
      $comment_as_submitted = get_comment_meta( $comment->comment_ID, 'akismet_as_submitted', true );
      
      if ( $comment_as_submitted ) {
        delete_comment_meta( $comment->comment_ID, 'akismet_as_submitted' );
        $items_removed = true;
      }
    }

    // Tell core if we have more comments to work on still
    $done = count( $comments ) < $number;
    
    return array(
      'items_removed' => $items_removed,
      'items_retained' => false, // always false in this example
      'messages' => array(), // no messages in this example
      'done' => $done,
    );
  }
 

 View on GitHub View on Trac

Published: 19th December 2019 | Last updated: 19th December 2019

Primary Sidebar

Information

Function name: Akismet_Admin::erase_personal_data
Class ref: Akismet_Admin
Plugin ref: Akismet
Version: 5.0.1
Sourcefile: class.akismet-admin.php
File ref: class.akismet-admin.php
Deprecated?: No
API Letters: A,D,E,P

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 6.1.1. PHP: 8.0.27
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wp-a2z.org
© Copyright WordPress a2z 2014-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites