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) »
  • Make field view only after profile created?
Pages: [1]

Author Topic: Make field view only after profile created?  (Read 1439 times)

BSCManage

  • Guest
Make field view only after profile created?
April 25, 2011, 05:06:21 pm
I am using a Custom profile to submit as a "member application form" and I am wanting the email address of my members to be used as their username for login. With this being the case I want once they fill out the membership form that in their "My Account" the Email field is only viewable and not editable. Is this possible?

Currently I get the error that a "View only field can not be required". Is there a way around this?
« Last Edit: April 25, 2011, 05:07:52 pm by BSCManage »

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: Make field view only after profile created?
April 25, 2011, 05:10:55 pm

You can use a hook for the "My Account" page and freeze the email field in the form there.

check

http://wiki.civicrm.org/confluence/display/CRMDOC32/CiviCRM+hook+specification

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

BSCManage

  • Guest
Re: Make field view only after profile created?
April 25, 2011, 05:16:10 pm
So I would use "hook_civicrm_customFieldOptions" and simply state that after the email is submitted make it a read only field on the "My Account" page? Sorry I am new to CiviCRM and this would be the first "hook" I have had to use.

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: Make field view only after profile created?
April 25, 2011, 05:20:23 pm
You would use

hook_civicrm_buildForm

and if u detect its the my account page (easiest way might be to check the value of $_GET['q']) then you can just freeze the email field using code similar to here:

http://svn.civicrm.org/sfschool/branches/v3.2/drupal/sfschool/sfschool.module (search for freeze)

Might also want to read:

http://en.flossmanuals.net/civicrm/DevelopIntro/

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Make field view only after profile created?

This forum was archived on 2017-11-26.