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) »
  • Why can't profiles with mixed field types be displayed on account pages?
Pages: [1]

Author Topic: Why can't profiles with mixed field types be displayed on account pages?  (Read 1226 times)

Spry_Julia

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
  • CiviCRM version: 4
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Why can't profiles with mixed field types be displayed on account pages?
March 03, 2013, 07:53:30 pm
I have been troubleshooting an issue where users cannot see the fields of a civi profile, even though I checked "View/Edit Drupal User Account" and verified that all Drupal permissions are correct.

I searched the documentation, the civi forums and Google for quite awhile, and ended up walking through the code with a debugger. I discovered that profiles with "mixed" fields will not be displayed on user account pages. Specifically, starting at line 1449 of UFGroup.php that says

// skip mix profiles in user Registration / User Account

  if (($moduleName == 'User Registration' || $moduleName == 'User Account') &&
        CRM_Core_BAO_UFField::checkProfileType($dao->id)
      ) {
        continue;
      }

1. Could anyone explain why this limitation was put in place?  The ability to see "mixed" fields would be extremely helpful, and the comment doesn't provide any reason why this decision was made.

2. Could anyone point me to where I should have found this documented online? It's surprising that I would be the only one who has run into this issue, but I didn't see any mention of it anywhere.

3. Is there another approach I can take in order to display mixed fields?

Thanks for any help!

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Why can't profiles with mixed field types be displayed on account pages?
March 04, 2013, 12:40:29 am
Can you define "mixed field types" a bit more explicity?

If I understand you correctly...

If they are field types from a membership or event participation, for example, we can't display them because contacts can have more than one of each and on the user edit/create page we don't have any way of knowing which record they should be referring to.

I guess you could always set a default membership type (or similar) for that page, but that would require some coding / be considered a new feature and there might be lots of unintended consequences of doing so.

Always worth adding more documentation to the code and in the book to explain things like that if you feel like it.  I am suprised that isn't in the book - if you want to add it, please let me know.

Thanks,
Michael
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Spry_Julia

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
  • CiviCRM version: 4
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Re: Why can't profiles with mixed field types be displayed on account pages?
March 15, 2013, 01:56:19 pm
Thanks for your response!

Sorry for not being more clear. I thought "mixed field types" was a civi term, since it's in the code comments. My understanding is that a "field type" in this context is a field from a certain civi function, like memberships or events. So a profile with "mixed field types" includes fields from more than one civi function.

Here it the specific issue: I have created a civi profile that has "View/Edit Drupal User Account" checked. It has the following fields:
Email (Contact)
First Name (Individual)
Last Name (Individual)
Street Address (Contact)
City (Contact)
State (Contact)
Postal Code (Contact)
Phone (Contact)
Membership Type (Membership)
Membership Status (Membership)

These profile fields do not appear in the user's View/Edit Drupal account screens. However, if I remove the membership fields, the profile fields appear when a user views their account info. 

I understand that people may have more than one membership. But how is a user supposed to see their membership information (regardless of how many memberships they have) if it isn't displayed in their account profile?

I'm happy to create patches or add documentation, but I don't feel like I undersand what's going on quite yet.  Thanks for helping me understand further.

Julia

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Why can't profiles with mixed field types be displayed on account pages?
March 15, 2013, 02:35:14 pm
Julia - can't they access their Membership info on their Contact Dashboard?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

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: Why can't profiles with mixed field types be displayed on account pages?
March 15, 2013, 04:38:27 pm

a few thoughts and comments:

1. I think memberships are exposed in the contact dashboard. You can also use views to display memberships (though the views integration is also looking for a maintainer)

2. For profiles to support "mixed types", will require some development work. I dont think its a trivial project (neither is it super hard), but i do think its a 40+ hour project (at the very least). If you would like to start working on this, ping us on IRC and we can help get u started

3. It is an acknowledged limitation in the profile model right now. Hopefully over a period of time this gets resolved and fixed by contributions and patches

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

Spry_Julia

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
  • CiviCRM version: 4
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Re: Why can't profiles with mixed field types be displayed on account pages?
March 18, 2013, 09:25:22 am
Thank you both for your replies! This information helps tremendously. I did not realize that the Contact Dashboard could be exposed to website users. I probably didn't look too closely because I thought I was on the right track with profiles, since it seemed to give me what I was looking for.

By the way, I just found this issue was mentioned in an old version of the civi wiki (http://wiki.civicrm.org/confluence/display/CRMDOC40/How+to+Create+Profiles). I don't see it in the current version of the wiki or the book, so I'll see if I can help include this in the current version of the documentation.  And since I clearly am at the beginning of the civi learning curve, the development work to address this may be more than I should tackle right now. I'll try to start small and work up to this.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Why can't profiles with mixed field types be displayed on account pages?

This forum was archived on 2017-11-26.