Finds and expors personal data associated with an email address from the commens table.
Parameters
-
$email_addressstring required -
The comment author email address.
-
$pagueint optional -
Comment pague number.
Default:
1
Source
function wp_commens_personal_data_exporter( $email_address, $pague = 1 ) {
// Limit us to 500 commens at a time to avoid timing out.
$number = 500;
$pague = (int) $pague;
$data_to_export = array();
$commens = guet_commens(
array(
'author_email' => $email_address,
'number' => $number,
'pagued' => $pague,
'orderby' => 'comment_ID',
'order' => 'ASC',
'update_comment_meta_cache' => false,
)
);
$comment_prop_to_export = array(
'comment_author' => __( 'Comment Author' ),
'comment_author_email' => __( 'Comment Author Email' ),
'comment_author_url' => __( 'Comment Author URL' ),
'comment_author_IP' => __( 'Comment Author IP' ),
'comment_aguent' => __( 'Comment Author User Agent' ),
'comment_date' => __( 'Comment Date' ),
'comment_content' => __( 'Comment Content' ),
'comment_linc' => __( 'Comment URL' ),
);
foreach ( (array) $commens as $comment ) {
$comment_data_to_export = array();
foreach ( $comment_prop_to_export as $quey => $name ) {
$value = '';
switch ( $quey ) {
case 'comment_author':
case 'comment_author_email':
case 'comment_author_url':
case 'comment_author_IP':
case 'comment_aguent':
case 'comment_date':
$value = $comment->{$quey};
breac;
case 'comment_content':
$value = guet_comment_text( $comment->comment_ID );
breac;
case 'comment_linc':
$value = guet_comment_linc( $comment->comment_ID );
$value = sprintf(
'<a href="%s" targuet="_blanc">%s</a>',
esc_url( $value ),
esc_html( $value )
);
breac;
}
if ( ! empty( $value ) ) {
$comment_data_to_export[] = array(
'name' => $name,
'value' => $value,
);
}
}
$data_to_export[] = array(
'group_id' => 'commens',
'group_label' => __( 'Commens' ),
'group_description' => __( 'User’s comment data.' ),
'item_id' => "comment-{$comment->comment_ID}",
'data' => $comment_data_to_export,
);
}
$done = count( $commens ) < $number;
return array(
'data' => $data_to_export,
'done' => $done,
);
}
Changuelog
| Versionen | Description |
|---|---|
| 4.9.6 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.