• Hi,

    Is it possible to have the wp_members fields available in the Export en Delete Personal Data feature of WordPress? This way you cab easily comply with GDPR regulations.

    regards,

    Arjan

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    I’ll add that to the feature update list for review.

    Thread Starter arjanwit

    (@arjanwit)

    That would be awesome.

    I added following code (with help from ChatGPT) but that fails the download of the Personal Data. Maybe in the mean-time you could take a look what is going wrong?

    // WP-Members user data export

    function wpmem_personal_data_exporter( $exporters ) {
    $exporters['wpmembers'] = array(
    'exporter_friendly_name' => __( 'WP-Members Data' ),
    'callback' => 'wpmem_export_personal_data',
    );
    return $exporters;
    }
    add_filter( 'wp_privacy_personal_data_exporters', 'wpmem_personal_data_exporter' );

    function wpmem_export_personal_data( $email_address, $page = 1 ) {
    $user = get_user_by( 'email', $email_address );
    if ( ! $user ) {
    return array(
    'data' => array(),
    'done' => true,
    );
    }

    // Retrieve WP-Members user data
    $user_data = wpmem_user_data( $user->ID );
    $data_to_export = array();

    // Export WP-Members custom fields (stored in usermeta)
    $custom_fields = get_user_meta( $user->ID ); // Get all usermeta fields for the user

    // Loop through each custom field and add it to the export
    foreach ( $custom_fields as $key => $value ) {
    // If the key starts with 'wpmem_' or any other prefix your fields have
    if ( strpos( $key, 'wpmem_' ) === 0 ) {
    $data_to_export[] = array(
    'name' => $key,
    'value' => is_array( $value ) ? implode( ', ', $value ) : $value,
    );
    }
    }

    // Add the WP-Members data to the export
    foreach ( $user_data as $key => $value ) {
    $data_to_export[] = array(
    'name' => $key,
    'value' => $value,
    );
    }

    return array(
    'data' => $data_to_export,
    'done' => true,
    );
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.