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) »
  • Discussion (deprecated) »
  • Professional CiviCRM Services (Moderator: Dave Greenberg) »
  • Permissions for fields - needed ASAP
Pages: [1]

Author Topic: Permissions for fields - needed ASAP  (Read 1430 times)

jsimonis

  • I post frequently
  • ***
  • Posts: 316
  • Karma: 4
    • Forward Support, Inc.
  • CiviCRM version: 4.4-4.5
  • CMS version: Drupal 7
  • MySQL version: 5.5.37-cll
  • PHP version: 5.3.29
Permissions for fields - needed ASAP
February 13, 2011, 01:19:01 am
I need help ASAP on how to allow sets of fields to show or not show based on a user's preference.

We're using Views to create member listings and a search form. I need to show or not show certain fields based on a person's preference. We have a yes/no question asking if each set of information can be shared. If they say no, I need to not show the info.

I've got to get this set up ASAP. I thought maybe something could be done with smart groups and Views arguments or something along those lines?
« Last Edit: February 13, 2011, 01:57:36 am by jsimonis »

jsimonis

  • I post frequently
  • ***
  • Posts: 316
  • Karma: 4
    • Forward Support, Inc.
  • CiviCRM version: 4.4-4.5
  • CMS version: Drupal 7
  • MySQL version: 5.5.37-cll
  • PHP version: 5.3.29
Re: Permissions for fields - needed ASAP
February 13, 2011, 02:03:00 am
If it would be faster, a way to do it inside CiviCRM so people could decide whether or not a field is public or not. I've just got to find a way to be able to show or hide fields based on a user's preference. And because they can decide to have some fields show and not others, I can't just hide their info entirely if they say no to one set of fields.

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: Permissions for fields - needed ASAP
February 13, 2011, 09:09:05 pm
Hi jsimonis,

My coworker recently developed code to do just this.  He's in Senegal right now and will be traveling back to the US tomorrow morning, or I'd point him in this direction.

I know what the general approach was - there's three fields for every actual field.  So to take an example - to allow users to hide/display last name,  there's a custom field lastname_show, which can have the value "yes" or "no".  Then there's a view-only field lastname_public. 

I THINK what happens is there's a Drupal module that gets called when a user hits Save on their profile edit screen.  It runs a PHP routine that sets the value of lastname_public to the same value as fruit, or blanks it out, depending on the value of fruit_show.

I hope that's enough info for you to recreate the solution on your own; if not, ping me in a day or two.  I don't know when he'll be available to work, or what his priorities are, but I can at least point him to this post.

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Professional CiviCRM Services (Moderator: Dave Greenberg) »
  • Permissions for fields - needed ASAP

This forum was archived on 2017-11-26.