Newsletter: Codex – Read a Subscriber

You can use the code of the WordPress Newsletter plugin to read a subscriber from the database. It will return the subscriber record as an object with all the fields and it will include the custom field keys/values too.

<?php

//check if the wpMail class has been defined
if (class_exists('wpMail')) {
//initialize the wpMail class into an object
if ($wpMail = new wpMail()) {
global $Db, $Subscriber;
$Db -> model = $Subscriber -> model;

//fetch the subscriber
//you can use 'id', 'email', 'ip_address' or 'user_id' for conditions
if ($subscriber = $Db -> find(array('id' => 123))) {
//now you can use the subscriber data according to your needs.
print_r($subscriber);
}
}
}

?>

You can get the raw code here.

Earn Money by Referring People

Refer customers to us with your affiliate link and earn commission on sales from your link.

Get Started

Pin It on Pinterest