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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Customising Privacy flags
Pages: [1]

Author Topic: Customising Privacy flags  (Read 3230 times)

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Customising Privacy flags
October 25, 2007, 01:11:25 pm
A staff member has requested customisation of the "Privacy" fields in the contact edit screen (he wants "Do not trade" removed, initially).

I can see it's possible to change these by modifying the core files @ CRM/Contact/Form/Edit.php @ ln 755 (using 1.8). However I'd rather do this via either a custom template or a modular approach in order to maintain our upgrade path.

Are these values referenced elsewhere in the code? (IE, does "do not mail" or "do not email" have an automatic effect when printing mailing labels / bulk emailing, or do we need to include them in our filters when generating mail/email lists? Does "do not trade" effect the availability of anything via CiviCRM-ecommerce?)

This would be possible to implement in CSS if there was a specific CSS id / class wrapping each of the options in the edit form - I could simply make the field not visible, and wouldn't have to worry about breaking compatibility with other systems in the backend.

Any thoughts?
@xurizaemon ● www.fuzion.co.nz

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Customising Privacy flags
October 25, 2007, 05:39:49 pm

checkbox fields are "special" in html post :(. i.e. no checkbox in the POST means we assume that they have all been unchecked. So you cannot just remove them from the template (like most other fields if u want them hidden)

do-not-email is used by civimail / optout  functions.

do-not-trade is basically for use by orgs who want to swap mailing list info (was added at the request of a few orgs)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Customising Privacy flags
October 26, 2007, 02:54:28 pm
You might be able to hide the Do not trade checkbox element by creating a custom copy of CommPrefs.tpl and adding javascript in the template which hides that element based on it's id or it's name + element type. The HTML for that element which is output by Quickform includes the checkbox and a hidden field with the same name which I believe handles the checkbox-not-checked POST issue.

Code: [Select]
<input type="hidden" name="privacy[do_not_trade]" value="" />
<input name="privacy[do_not_trade]" type="checkbox" value="1" id="qf_693b70" />
Protect your investment in CiviCRM by  becoming a Member!

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: Customising Privacy flags
October 26, 2007, 04:35:47 pm
That would work, but from what I saw QF applies a useful selector only to the checkbox - which would leave the label visible as well.

I'll have to look into QuickForms and see if we can get CiviCRM to apply IDs to the label container as well, which would make this sort of thing possible via simple CSS.
@xurizaemon ● www.fuzion.co.nz

nicrodgers

  • Guest
Re: Customising Privacy flags
November 26, 2008, 04:15:15 am
Did you have any luck with this?
We've also been asked to remove the 'Do not trade' option and I'd be interested in how you got on!

Nic

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Customising Privacy flags
November 26, 2008, 04:44:35 am
Nic:

Another hack for this would be to modify CRM/Core/SelectValues.php, function privacy() , remove " 'do_not_trade' => ts('Do not trade') "

Kurund

Found this reply helpful? Support CiviCRM

nicrodgers

  • Guest
Re: Customising Privacy flags
November 26, 2008, 07:37:47 am
Thanks. I just tried that and it took the label away, but the checkbox remained :(



Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Customising Privacy flags
November 26, 2008, 08:17:21 am
You will also have to modify, civicrm/CRM/Contact/Form/Edit.php, in buildCommunicationBlock()

remove: $privacy[] = HTML_QuickForm::createElement('advcheckbox', 'do_not_trade', null, $t['do_not_trade']);

HTh

Kurund
Found this reply helpful? Support CiviCRM

nicrodgers

  • Guest
Re: Customising Privacy flags
November 26, 2008, 08:49:23 am
Kurund, you're a star. That worked! Thanks.

alphageekboy

  • I’m new here
  • *
  • Posts: 11
  • Karma: 1
  • Web Developer
    • Alpha Geek Tech, LLC
Re: Customising Privacy flags
August 11, 2010, 09:32:40 pm
I know this is an old topic, but I have the same issue and was able to remove the label with no problem.  However, the instructions for removing the checkbox no longer in version 3.2 and above (maybe version 3 and above) as the edit.php file is now a directory, and the checkbox is now contained in a for each leave.

I tried doing some type of "if" statement to check the name, but never really could figure it out.

Anyone know what edits I would have to make in /civicrm/CRM/Contact/Form/Edit/CommunicationPreferences.php to get this to work.
Tracy C. Smith
Chief Technologist & Founder

Alpha Geek  Tech, LLC
p: 831.706.2187
http://alphageektech.net
skype/aol: tracycsmith
t: alphageektech

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Customising Privacy flags
August 12, 2010, 08:23:12 am

Code: [Select]
        foreach ( $privacyOptions as $name => $label) {
            if ( $name != 'do_not_trade' ) {
              $privacy[] = HTML_QuickForm::createElement('advcheckbox', $name, null, $label );
           }
        }
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Customising Privacy flags

This forum was archived on 2017-11-26.