Login | Sign up | Toll-Free: 1-800-752-0455
 
 

Forum

 

3 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: March 5

Hi All.

I'm wondering how I would go about sending an email (either via the newsletter module, or via an email template) to those members who have a certain favorite?

Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au

By Dave - March 5

Hi Tim, 

You'd need to write a custom query, the MySQL Developer console is good for practicing those (backup first through the CMSB interface): 
https://www.interactivetools.com/add-ons/developer-console/

Here's an example of a subquery that checks a second table to only return records that has a certain field set: 

SELECT num, email, isAdmin
  FROM {$TABLE_PREFIX}accounts
 WHERE num IN (
       SELECT num FROM {$TABLE_PREFIX}accounts WHERE isAdmin = 1
     )

Try that in the MySQL Developer Console.  First work on that subquery on it's own.  You want a query that returns all the user nums that have a certain favorite.  Then put that query inside the outer one. 

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

Thanks Dave. 

For anyone else that's trying a similar thing, this query works for me;

SELECT num, email
FROM cmsb_members
WHERE num IN (
SELECT createdByUserNum FROM cmsb__website_favorites WHERE recordNum = 7
)

So I've now created a "mailing list" via the newsletter plugin.

Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au