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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Profiles and Field Visibility
Pages: [1]

Author Topic: Profiles and Field Visibility  (Read 670 times)

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Profiles and Field Visibility
April 19, 2010, 11:43:02 am
I'm encountering what seems to be a change in 3.+ from previous versions. In previous versions, I could set a custom data field in a profile as view only and it would appear on various pages to users as non-editable. Now the field isn't showing up on all of the pages. I was able to reproduce on the demo site. I used Last Name as the test field.

CiviCRM Profile (Name and Address)

Field (Last Name) set to:
.....Visibility: User and User Admin Only (setting doesn't seem to matter)
.....Active: Yes
.....View Only: Yes

http://drupal.demo.civicrm.org/user/2
.....Last Name is visible

http://drupal.demo.civicrm.org/user/2/edit/Name%20and%20Address
.....Last Name is not visible  (In previous versions, the Label and Data would be visible but not editable.)

Is this a bug, or new behavior?
--
Joe

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: Profiles and Field Visibility
April 19, 2010, 03:51:16 pm

we dont have a running 2.x site to verify this behavior. I dont think we changed this behavior.

If we did, you might want to consider investigating the code to get the old behavior back. If you do so, please file a issue along with a patch

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

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Profiles and Field Visibility
April 22, 2010, 08:08:49 pm
This probably isn't the best resolution...but it works. We needed to keep a profile field (current_employer) as view only, and offer an edit field that could be monitored. The new behavior in 3.0 of "view only" for a profile field totally removes the field from an edit page. We modified the code in sites/all/civicrm_templates/CRM/Profile/Form/Dynamic.tpl.


   {if $field.html_type eq 'Radio' and $form.formName eq 'Edit'}
            &nbsp;&nbsp;(&nbsp;<a href="#" title="unselect" onclick="unselectRadio('{$n}', '{$field.groupTitle}'); return false;">{ts}unselect{/ts}</a>&nbsp;)
   {/if}
        {/strip}
        </td>
    </tr>
   {else}

          {* **** added - if, else and disabled to keep current employer not editable ****  *}
        <tr id="editrow-{$n}">
           <td class="label">{$form.$n.label}</td>
           <td class="edit-value">
           {if $n|substr:0:3 eq 'im-'}
             {assign var="provider" value=$n|cat:"-provider_id"}
             {$form.$provider.html}&nbsp;
           {/if}
+           {if $n eq 'current_employer'}
+          <input type="text" id="current_employer-read" name="current_employer" value="{$form.current_employer.value}" disabled>
+                 {else} 

           {if $n eq 'email_greeting' or  $n eq 'postal_greeting' or $n eq 'addressee'}
                {include file="CRM/Profile/Form/GreetingType.tpl"} 
           {elseif ( $n eq 'group' && $form.group ) || ( $n eq 'tag' && $form.tag )}
            {include file="CRM/Contact/Form/Edit/TagsAndGroups.tpl" type=$n}
           {else}
               {if ( $field.data_type eq 'Date' or
                          ( ( ( $n eq 'birth_date' ) or ( $n eq 'deceased_date' ) ) ) ) }
                  {include file="CRM/common/jcalendar.tpl" elementName=$n} 

                {else}       
          {$form.$n.html}       
        {/if}
+         {/if}
               {if ($n eq 'gender') or ($field.html_type eq 'Radio' and $form.formName eq 'Edit')}
--
Joe

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Profiles and Field Visibility

This forum was archived on 2017-11-26.