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.

WordPress Plugins

Start selling products, sending newsletters, publishing ads, and more through your own WordPress website using our premium WordPress plugins.

Browse

Pin It on Pinterest