I have a use case where there are 2 different content profiles node types, both of which are using field_name field. Since you have to select only one profile(node) type to choose the realname fields from, real names are showing for only users with the profile type that is chosen.

Is there anyway to get this working for all profile types?

Thanks.

Comments

nancydru’s picture

Status: Active » Postponed (maintainer needs more info)

Do you have any clue how? Are there other modules that access multiple types?

nancydru’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)
smoothk’s picture

Hi there, NancyDru!

I seem to have the same issue and I'm asking for a suggestion: following this post here
http://drupal.org/node/313341#comment-1460184
I managed to have multiple content profiles for different roles using Content Profile, Auto Assign Role and the patch riverfr0zen put together.

I have some roles with Name and Surname, and others with Organization Name.
Right now it's possible to select just one Content Profile content type, while in my case would be necessary to have a multiple select - check boxes instead of radio buttons - and then choose which fields for each content type to use.

How hard you think it'll be to make that happen? Where should I look?

Balbo’s picture

any news here?

jannol’s picture

I have 2 content profiles set up, member_profile and company_profile and they have different roles

in member_profile I have field_first_name and field_last_name
in company_profile I use a field as the existing field_first_name but labeled as Company name

in realname.module after line 743 (I think my version is unchanged, realname.module,v 1.4.4.57 2009/10/13 17:48:06 nancyw) I added one line of code that checks if my user is of role company and if so, It simply uses the existing field in my company_profile content. I also replaced the pattern to use %1 so it only uses the first_name field.

I am quite new to drupal so I have no idea how bad approach this is, nor have I yet tested it thoruoghly.

org

    $profile_privacy = module_exists('profile_privacy');
    if ($module && module_exists($module)) {

edited

    $profile_privacy = module_exists('profile_privacy');
    if ($account->roles AND in_array('company',$account->roles)) { $type = 'company_profile'; $pattern_saved = '%1'; } // extra CP by Role (jannol)
    if ($module && module_exists($module)) {
jannol’s picture

Ok previous didn't work all they way.

In order to get more stuff working I have removed pattern_saved since pattern_saved doesn't seem to matter to if there are %1 and %2 or just %1 or maybe there is permissions stuff to consider, I haven't got there yet so I allow company role to both view and edit own field_last_name even though there is no such fields in company_profile content.

if ($account->roles AND in_array('company',$account->roles)) { $type = 'company_profile'; } // extra CP by Role (jannol)

and then in realname_content_profile.inc
I changed

  $profile = content_profile_load($type, $account->uid);
  if (!$profile) {
    return;
  }

to

  $profile = content_profile_load($type, $account->uid);
  // extra CP by Role - 3 lines (jannol)
  if (!$profile) {
    $profile = content_profile_load('company_profile', $account->uid);
  }
  if (!$profile) {
    return;
  }

And now I have the Company name showing in both pages/nodes/private msg

I know my "solution" might be ugly hacks but in order to be able to write more later for either me or anyone else I try to find out what to do.
Please let me know if I am on thin ice?!

Happy realnaming for now, I'll be back :-P

nancydru’s picture

Please move the discussions to the active issue, this one is a duplicate.