CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Adding 'do not email' checkbox leaves null value if not ticked..
Pages: [1]

Author Topic: Adding 'do not email' checkbox leaves null value if not ticked..  (Read 1977 times)

nicol

  • I post occasionally
  • **
  • Posts: 95
  • Karma: 5
  • CiviCRM version: 4.2, 4.3, 4.4
  • CMS version: Joomla 2.5.x, Joomla 3.x Wordpress 3.x, Drupal 7.x
  • MySQL version: 5.x
  • PHP version: 5.3 / 5.4
Adding 'do not email' checkbox leaves null value if not ticked..
October 21, 2012, 01:33:22 pm
Hello,

On a membership signup, in order to give people the chance to opt out our mailing list, I've included a profile with the field 'do not email'.. It appears like this:

"We will send you a weekly newsletter made up of upcoming events, notices and information. If you do not want to receive this, tick the box below:
[] Do not email newsletter   

However, if someone doesn't tick the [] Do not email box (because they want to receive our mail)  it enters a NULL value into the Do Not Email column on their record. This means that if I try to do a mailing to all members where "Do Not Email != 1" it will include those who've opted out *and* those with NULL in the dbse. (It's taken me a while to figure out this is why new signups weren't getting an email)

The only way round this I can see would be to have a preselected radio button, eg:

"We will send you a weekly newsletter made up of upcoming events, notices and information. If you do not want to receive this, select NO below:
  • yes please send me email [] no email


But not sure how to switch the default output.. or perhaps there's a more elegant way to do what I'm doing.

thanks
Nic

Jason W

  • I post frequently
  • ***
  • Posts: 197
  • Karma: 12
  • jason@civitrainingtutorials.com
  • CiviCRM version: 4.2
  • CMS version: Drupal 7
  • MySQL version: 5.x
  • PHP version: 5.x.x
Re: Adding 'do not email' checkbox leaves null value if not ticked..
October 31, 2012, 12:43:32 pm
Hello Nic,

I would Create a custom field with the label "would you like to recieve our Newsletter", of the type "Yes or no", Field type "Radio",  default value should be 1 for yes or 2 for no, and searchable.

Seems like this would be the easiest way to fix your problem.

Cheers!
Jason
civiTrainingTutorials
"Helping You Help Others"

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: Adding 'do not email' checkbox leaves null value if not ticked..
June 02, 2013, 07:16:53 pm
Hi Nic,

I just found this same bug today!  I dug into it, and I created a patch:
http://issues.civicrm.org/jira/browse/CRM-12748

Note that the patch is against my outdated copy of Civi 4.4alpha - but it's only three lines to patch, so if you want to manually patch your own install, you can probably figure it out.  Hopefully, the core team will get this fix into 4.3.4, so you don't have to do this yourself if you don't want.

Jon
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

nicol

  • I post occasionally
  • **
  • Posts: 95
  • Karma: 5
  • CiviCRM version: 4.2, 4.3, 4.4
  • CMS version: Joomla 2.5.x, Joomla 3.x Wordpress 3.x, Drupal 7.x
  • MySQL version: 5.x
  • PHP version: 5.3 / 5.4
Re: Adding 'do not email' checkbox leaves null value if not ticked..
June 03, 2013, 03:54:15 am
Hi Jon,
That's great.. thanks! hope it makes it into 4.3.4.
cheers, Nic

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Adding 'do not email' checkbox leaves null value if not ticked..

This forum was archived on 2017-11-26.