I am setting up a multilingual Intranet server based on Drupal 6.

When I allow the "Profile" content type to be translated, then the Content Profile module shows me a "create" link whenever I click on a user name to see their profile, even though the user already has a profile.

Disabling content translation for the Profile content type functions correctly.

Comments

There is a bug in content_profile.module:content_profile_load() that I haven't quite worked out yet. I will post again soon with a fix.

StatusFileSize
new602 bytes

Status:Active» Needs review

Changing status

hi, the link for the file does nto link to anything.

Chris

Status:Needs review» Needs work

@ wad

Please attach the correct files.

StatusFileSize
new602 bytes

Sorry for the bad posts. I was getting disconnected from d.o. due to too many mysql connections.

This is only a partial fix that will stop the behaviour mentioned by the o.p. The real fix should allow several content_profile content items to be valid depending on what language they are viewed in. For example, I should be able to create a profile in Spanish and English with a fallback to the site's default language (English) if there is no Spanish profile created yet. I think the real bug there is that cp content is not being saved with a language but I could be wrong.

Status:Needs work» Needs review

Status:Needs review» Needs work

>I think the real bug there is that cp content is not being saved with a language but I could be wrong.

Content profile doesn't change the usual node-behaviour here, so this should work fine.

As of now, the profile is displayed in the currently activated language on the user page. I'm not sure if it should fall-back to the default language, if there is no profile in the current one. If you think so, roll a patch..

However content_profile_load() should always work right, with the above patch it would return the wrong language profile afterwards even if the language is specified explicitly.

Good point.

I do not know which module should be in charge of selecting the appropriate language version of multilingual content. Each language version is a separate nid. IIRC there's a distinct table keeping track of which nids link to the same "meta node".

Maybe it's just a matter of implementing one or more i18n hooks in the content_profile module?

@fago: there is definitely a problem with translation handling. I will try to explain the situation without the above patch.

In a test site, I have these content items and users, where

  • Profile is a content type with these options checked:
    • Multilingual Support: Enabled, with translation
    • Content Profile Use this content type as a content profile for users
  • I have both English (default) and Spanish languages enabled with these options checked:
    • at /admin/settings/language/configure I have Language negotiation: Path prefix with language fallback
    • at /admin/settings/language/i18n/configure I have Content selection mode: Current language and language neutral.
  • Anonymous and Authenticated users have permissions to access both content and user profiles.
  • Authenticated users also have permissions to create, delete and edit their own profile content and translate content.

Title           Type        Author  Status      Language
================================================================
Test 2 User     Profile     test2   published   Language neutral
Test 1 User     Profile     test1   published   English
UID     Username    Status  Roles
==================================
4       test2       active  artist
3       test1       active  artist
1       admin       active

When I visit /users/test1, I see the Test 1 User node content

When I visit /users/test2, I see the default (system) profile content with a link to 'Create the user's Profile.'

When I visit /es/users/test1, I see the default (system) profile content with a link to 'Create the user's Profile.' Same applies for test2.

As test1 user (UID=3), when I visit /es/user/3/edit/profile, I get a new form to create a new profile. If I change the node's language to Spanish and save it I get a new node. Switching languages shows the relevant content from each node correctly. However, I do not see a link to Translate the node I am editing in either language.

As test2 user (UID=4), when I visit /es/user/4/edit/profile, I get a new form to create a new profile. If I leave the node's language as 'Language neutral' and save it, it throws the error: This user has already a content profile of this type. You can only create one profile per user. The message should say "You can only create one profile per user per language" which is kinda confusing.

Using the above patch, I at least get 'Language neutral' content to display but there is more to be done for correct handling.

subscribing.

sub

subscribing

Also interested in a solution... Subscribing.

Susbcribing. Any idea when will you be able to apply something to a release?

another related issue #368510: Translate node types
if you only need to fix the title translation you have two choices (exclusive, just one or the other)
368510#comment-2061346
368510#comment-2061360

Susbcribing

I think if a node type has been checked to be a content profile, it shouldn't be shown under "Create content". It should only appear in the edition of "My account".
And, if the site has translations enabled, and the user the permissions to translate, In that tab inside my account, the user should be able to translate the content profile.

In node limit number (#586064-22: Node Limit Number for Drupal 6 - FEATURES REQUEST) @jdwfly gave me a code for another thing, that allows to check if the new node is a translation, maybe that can be used here:

if (isset($node->translation_source)) {
  return FALSE;
}
return TRUE;

I'm using the new node limit number module for drupal 6 and created a rule saying that a user can create one node of content profile unless the new node it's a translation, and it worked.
So, it should only be necessary to remove the option to create a node type under "create content" and to create a translate link in the Account. So, after the user has a profile created, he can translate it. Is there any way you can include this?

And of course, in the profile page, when I change language, the content should be shown according to the language, as now is not doing that. It always shows the original node.

in my case, when viewing a a user page, content_profile_load is called, $lang isn't set.

so adding a language-retrieval and a fallback, if language isn't available works as a quickfix.

<?php
function content_profile_load($type, $uid, $lang = '') {
  static
$cache = array();
  global
$language ;
 
$lang = $language->language;
  if (!isset(
$cache[$type][$uid][$lang])) {
   
$cache[$type][$uid][$lang] = FALSE;
   
$params = array('type' => $type, 'uid' => $uid);
    if (
$node = node_load($lang ? $params + array('language' => $lang) : $params)) {
     
$cache[$type][$uid][$lang] = $node->nid;
    }
    else {
     
// current language not available so try without
     
$node = node_load($params);
     
$cache[$type][$uid][$lang] = $node->nid;
    }
    return
$node;
  }
  return !empty(
$cache[$type][$uid][$lang]) ? node_load($cache[$type][$uid][$lang]) : FALSE;
}
?>

though, it would be interesting, why the $lang variable isn't set...

Does exist a solution of this problem? I'm having this problem and I really need to find a solution: my users need to have a translatable content profile but they cannot :-(

Don't know if this is brought up somewhere else, but also the panels integration of node_profile should be adjusted to allow for translated profiles.

I noticed in node_from_user.inc, in the function "content_profile_node_from_user_ctools_context" content_profile_load($conf['type'], $uid) (line 39) is called without $lang argument. Would adding in the active language there correctly call the translated profile ?

Tnx,

HnLn

Subscribing

Subscribing

When using direct path to access profil node with nid (node/%nid/edit) translation link display well.

Then I want to translate this node by using this translation link : be sure to give user create {node type for this profik} create permission !
I create a node, save it but there is something wrong : node is well created but it is not considered as the previous node translation.

Last try : I've hard created a translation for this profile node using core Drupal functions : edit profile node > translate, select a third language (not the second that previously failed) and so on. New node is created and well considered as a translation from the original profil node.

There is something wrong with node api (content_profile_nodeapi ?)...

Version:6.x-1.0-beta3» 6.x-1.0

Still active in current version.

@Domsou What do you mean with "There's something wrong with node api (content_profile_nodeapi)" ? Are you seeing a PHP crash?

@ShutterFreak

No, no PHP crash.

#22 works well for me using 6.x-1.0, thanks!

As a bonus, if you enable the option "Switch interface for translating" at admin/settings/language/i18n, when editing the content profile from within the user account the user can now translate the node simply switching the whole site language.

subscribing. I tried #22 but nothing changed. Still can't translate the node. it only shows up in the language I created it with. Can't create a second uprofile node in a different language and I really don't want to install any more modules because my memory isn't high enough for that.

Does anybody know how to get this working? I think it is quite an important feature, and it seems that there is a common interest as well.

We use the user profiles and content profiles for a directory type of website, where we control which content goes on the website. This way we are not bombarded with lots of user content, that fills up the "..to translate" cue.

It would be great to have the option to translate the user profile content if required.

+1

#22 Works perfect for me

Sorry, how did you implement #22? in which file must I add that code?

thank you!

#22 is a replacement function for content_profile_load in content_profile.module
http://drupalcontrib.org/api/drupal/contributions--content_profile--cont...

it would be easier if it was provided as a patch, so feel free to create one

ok, thank you

Version:6.x-1.0» 6.x-1.x-dev
Assigned:Unassigned» claudiu.cristea

Status:Needs work» Needs review
StatusFileSize
new2.54 KB

Here's a patch that works for me.

StatusFileSize
new2.53 KB

Trailing spaces cleanup.

StatusFileSize
new2.56 KB

Prevent a case when having more than 1 node with the same UID, type and default language.