function newsletters_user_register(&$pObject)
 {
     if (!empty($_REQUEST['newsletter_optin'])) {
         // hidden flag to indicate at least one newsletter was displayed
         require_once NEWSLETTERS_PKG_PATH . 'BitNewsletter.php';
         require_once NEWSLETTERS_PKG_PATH . 'BitNewsletterMailer.php';
         if (!empty($_REQUEST['unsub_all'])) {
             $subHash['unsubscribe_all'] = 'y';
         } else {
             $newsletter = new BitNewsletter();
             $pParamHash = array();
             $newsletters = $newsletter->getList($pParamHash);
             foreach (array_keys($newsletters) as $nlContentId) {
                 if (empty($_REQUEST['nl_content_id']) || !in_array($nlContentId, $_REQUEST['nl_content_id'])) {
                     $subHash['unsub_content'][] = $nlContentId;
                     $subHash['unsubscribe_all'] = NULL;
                 }
             }
         }
         if (!empty($subHash)) {
             $subHash['sub_lookup'] = array('user_id' => $pObject->mUserId);
             BitNewsletterMailer::storeSubscriptions($subHash);
         }
     }
 }
<?php

/**
 * Copyright (c) 2005 bitweaver.org
 * All Rights Reserved. See below for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
 *
 * created 2005/12/10
 * @author spider <*****@*****.**>
 *
 * @package newsletters
 */
/** 
 * Initialization
 */
require_once NEWSLETTERS_PKG_PATH . 'BitNewsletter.php';
$listHash = array('registration_optin' => TRUE);
$newsletters = BitNewsletter::getList($listHash);
global $gBitSmarty;
$gBitSmarty->assign('newsletters', $newsletters);