user emails to form

5 posts by 2 authors in: Forums > CMS Builder
Last Post: August 12, 2011   (RSS)

Re: [Toledoh] user emails to form

By Jason - August 11, 2011

Hi Tim,

What is stored in $CURRENT_USER['notifications']? Is it a multi-value check box list of emails?

Let me know and we'll try to come up with a solution for you.

Thanks,
---------------------------------------------------
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: [Jason] user emails to form

By Toledoh - August 11, 2011

I thought the easiest thing would be to have a checkbox in the user table that is either Yes or No called "notifications"

If that checkbox is ticked, it means that that user should be added to the email list.

If that's too easy :) I also have a list of projects (pulled from another table "projects" as value=num, label=title). We could use something like;
$listOptions = getListOptions('accounts', 'project');
$emailProject = "";
if (@$_REQUEST['project']) {
$emailProject = $listOptions[@$_REQUEST['project']];}
to identify the specific project being discussed, and then send emails ONLY to those users that have that project selected in their list of accessible projects.
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] user emails to form

By Jason - August 12, 2011

Hi Tim,

So what you need is to select all users who have the notifications check box checked and are selected for the project selected in $_REQUEST['project'] and create a comma-separated list of those emails.

Is that right?

If so, you can use something like this:
$accounts = mysql_query_fetch_all_assoc("SELECT * FROM `{$TABLE_PREFIX}accounts` WHERE notifications = '1' AND project LIKE '%\t".intval(@$_REQUEST['project'])."\t%'");
$emailList = join(",", array_pluck($accounts, 'email'));


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: [Jason] user emails to form

By Toledoh - August 12, 2011

WOW - perfect.

Thanks Jason!
Cheers,

Tim (toledoh.com.au)