Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
PUM_Privacy::exporter( $email_address, int $page = 1 )
Exporter for Popup Maker Optin Form Subscriber Data.
Description Description
See also See also
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Parameters Parameters
- $email_address
-
(Required)
- $page
-
(Optional)
Default value: 1
Return Return
(array)
Source Source
File: classes/Privacy.php
public static function exporter( $email_address, $page = 1 ) { $number = 500; // Limit us to avoid timing out $page = (int) $page; $export_items = array(); $subscribers = PUM_DB_Subscribers::instance()->query( array( 's' => $email_address, 'page' => $page, 'limit' => $number, 'orderby' => 'ID', 'order' => 'ASC', ), 'ARRAY_A' ); foreach ( (array) $subscribers as $subscriber ) { if ( $subscriber['email'] == $email_address ) { // Most item IDs should look like postType-postID // If you don't have a post, comment or other ID to work with, // use a unique value to avoid having this item's export // combined in the final report with other items of the same id $item_id = "pum-subscriber-{$subscriber['ID']}"; // Core group IDs include 'comments', 'posts', etc. // But you can add your own group IDs as needed $group_id = 'pum-subscribers'; // Optional group label. Core provides these for core groups. // If you define your own group, the first exporter to // include a label will be used as the group label in the // final exported report $group_label = __( 'Subscriber Data' ); // Plugins can add as many items in the item data array as they want $data = array(); foreach ( $subscriber as $field_key => $field_value ) { switch ( $field_key ) { case 'ID': $data[] = array( 'name' => __( 'ID', 'popup-maker' ), 'value' => $field_value, ); break; case 'email': $data[] = array( 'name' => __( 'Email', 'popup-maker' ), 'value' => $field_value, ); break; case 'name': $data[] = array( 'name' => __( 'Name', 'popup-maker' ), 'value' => $field_value, ); break; case 'fname': $data[] = array( 'name' => __( 'First Name', 'popup-maker' ), 'value' => $field_value, ); break; case 'lname': $data[] = array( 'name' => __( 'Last Name', 'popup-maker' ), 'value' => $field_value, ); break; case 'consent': $data[] = array( 'name' => __( 'Provided Consent', 'popup-maker' ), 'value' => ucfirst( $field_value ), ); break; case 'values': case 'consent_args': $values = maybe_unserialize( $field_value ); foreach ( (array) $values as $key => $value ) { // Empty values don't need to be rendered. if ( empty( $value ) ) { continue; } $label = ''; switch ( $key ) { case 'provider': $providers = PUM_Newsletter_Providers::instance()->get_providers(); if ( ! empty( $providers[ $value ] ) ) { $label = $providers[ $value ]->name; } break; case 'required': $label = __( 'Consent Required', 'popup-maker' ); break; case 'text': $label = __( 'Consent Text', 'popup-maker' ); break; case 'name': case 'lname': case 'email': case 'fname': case 'list_id': case 'popup_id': case 'email_hash': case 'pum_form_popup_id': case 'mc_args': // Leave these values out. break; } $label = apply_filters( 'pum_privacy_subscriber_value_label', $label, $key, $value ); if ( ! empty( $label ) ) { $data[] = array( 'name' => $label, 'value' => $value, ); } } break; case 'created': $data[] = array( 'name' => __( 'Date Subscribed', 'popup-maker' ), 'value' => $field_value, ); break; } } $export_items[] = array( 'group_id' => $group_id, 'group_label' => $group_label, 'item_id' => $item_id, 'data' => $data, ); } } // Tell core if we have more comments to work on still $done = count( $subscribers ) < $number; return array( 'data' => $export_items, 'done' => $done, ); }
Expand full source code Collapse full source code View on Trac