Website Membership

4 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: June 30, 2012   (RSS)

By depdesign - June 13, 2012

How can I add two email addresses to receive BCC notification when a user signs up. I'm using 1.05 and also have 1.07. Also, how can i change the email content that is sent. Thanks
Dan Perez

Re: [depdesign] Website Membership

By Jason - June 13, 2012

Hi,

What you can do is manually add in your BCC email addresses to the email headers in the code:

For example:

// send message
$emailTemplate = "emails/user-new-signup.php";
$emailHeaders = emailTemplate_load(array(
'template' => websiteLogin_pluginDir() . "/$emailTemplate",
'subject' => '', // set in template
'from' => '', // set in template
'to' => $_REQUEST['email'],
'placeholders' => array(
'username' => array_key_exists('username', $_REQUEST) ? $_REQUEST['username'] : $_REQUEST['email'], // if using email as username then show that instead
'password' => $password,
'loginUrl' => "http://" . $_SERVER['HTTP_HOST'] . $GLOBALS['WEBSITE_LOGIN_LOGIN_FORM_URL'],
),
));
//add BCC
@$emailHeaders['headers']['BCC'] = "email1@example.com,email2@example.com";

$mailErrors = sendMessage($emailHeaders);
if ($mailErrors) { die("Mail Error: $mailErrors"); }


The contents of the email is controlled by emails/user-new-signup.php located in the websiteMembership sub folder inside the plugins folder.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [depdesign] Website Membership

By gkornbluth - June 30, 2012 - edited: June 30, 2012

Hi depdesign,

If all of your recipients have user accounts, you might also think about changing the BCC values to a variable ($emailList) that gets populated from user email addresses where there's a "notifications" check box checked in their record.

Just a thought,

Jerry Kornbluth
Here's an untested recipe from my CMSB Cookbook thecmsbcookbook.com that might help.

First add a check box field called notifications to your user account editor.

Then, create your list from the accounts records.
<?php list($emailListRecords,) = getRecords(array(
"tableName" => "accounts",

'where' => "notifications = '1' AND hidden = '0'",
'orWhere' => "notifications = '1' AND hidden = '1'",
));

$emailList = "";

foreach( $emailListRecords as $record ) {

$emailList.= $record['email'] .",";
}
?>

Then use the variable in your sendmail code,

'To' => $emailList,
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php