I have few content types which are used as content profiles.
Even if I'm trying to open different type, nodeapi hook in content_profile module is called many times and after few calls no matter which node I've opened on current page, it redirecting to other existing node.
content_profile.module:
function content_profile_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
...
if ($op == 'prepare' && is_content_profile($node) && !isset($node->nid) && $node->uid && !user_access('administer nodes')) { // Check if this nodetype already exists
if ($nid = content_profile_profile_exists($node, $node->uid)) {
drupal_goto('node/'. $nid .'/edit', 'destination=user/'. $node->uid); // This node already exists, redirect to edit page
...
This is the first call of my original node:
stdClass Object ( [nid] => 24 [type] => page [language] => en [uid] => 1 [status] => 1 [created] => 1223552960 [changed] => 1223553227 [comment] => 0 [promote] => 0 [moderate] => 0 [sticky] => 0 [tnid] => 0 [translate] => 0 [vid] => 24 [revision_uid] => 1 [title] => New Parent [body] => [teaser] => [log] => [revision_timestamp] => 1223553227 [format] => 1 [name] => admin [picture] => [data] => a:2:{s:17:"mimemail_textonly";i:0;s:13:"form_build_id";s:37:"form-1b6529f21d8302903377e8b2ef98a3af";} )
This is the next nodeapi call, which cause redirection:
stdClass Object ( [uid] => 3 [name] => [type] => parent [body] => [title] => [format] => [status] => 1 [promote] => [sticky] => [created] => 1223559470 [revision] => )
The problem is that on my opened page there is no any form shows of above type.
Comments
Comment #1
kenorb commentedIn example I've three content types like cck1, cck2 and cck3, I've created cck2, but then when I'm going to page for Creating cck1 or cck3, then page is redirected to node which was firstly created. Problem is that module checking all content types which are set as content_profile, so even if there is only one of many, page is redirected to the first existing node.
It's a little misbehaviour functionality and I don't know if we can call this as bug or there is some solution.
Comment #2
kenorb commentedIt's because I'm using autoassignrole module which have possibility to select for which form you want to show the content form.
So to use functionality of autoassignrole module - attached patch needs to be applied.
Related to: #313341: setting up various content types for different roles
Integration of autoassignrole with content_profile module:
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/autoassignr...
Comment #3
fagohm, the code looks good to me as it is? It only redirects to the node of the same type - if there is already one. What's wrong with that?
Comment #4
kenorb commentedIt's quite complicated problem;)
Example:
I've got content_type1 and content_type2
Both are set to appear on profile registration, but on different paths (autoassignrole).
I'm changing that one content_type will appear on path1, and second on path2.
So the user using different paths will fill different details and will create account with different roles, like: node/add/parent (will have different content type than node/add/child).
But problem is that content_profile processing all content types which are marked as profile_registration (ignoring autoassignrole settings for specified path) and if you are going to path1 expecting form to fill (and if there is already record for the same user but of different type - like user has content_type2), content_profile will redirect the page to this record instead of showing the form of creation content_type1.
This functionality of selecting which content_profile should appear on which registration form could be implemented into content_profile, but at the moment this path is the solution.
Comment #5
fagook, then the problem is in your solution. Are you generating both forms at the pages? Perhaps you are generating both and just showing one..
>Both are set to appear on profile registration, but on different paths (autoassignrole).
But even if you would generate both paths, it's not possible for a user to register the same time using different paths. So there can't be no node for the user yet!?
Anyway, I think the problem is the code how autoassignrole (or your hack!?) integrates with content profile, not the content profile code. So I set this to won't fix.
However a proper solution supporting different registration paths on top of autoassignrole sounds to be a good thing! S
Comment #6
kenorb commentedYou can use different registration forms on different paths using http://drupal.org/project/formblock. Configure block on with pages you want to make registration form and just it.
You can also assign different roles depends on different paths when submitting registration form via autoassignrole module.
So there is no any hacks at all, it's only the new functionality which allow you set up various content types for different roles from different paths (as described here #313341: setting up various content types for different roles).
So this functionality is fully working, but above patch was needed to fix the content_profile issue when using with autoassignrole module.
Comment #7
fago>You can assign different roles depends on different paths when submitting registration form via autoassignrole module.
ok, but it does show the same profile form (= the same content types) for all roles, right?
Anyway, I still thing the problem is elsewhere. It looks like it generates a node form to add a new node of a type, which the user already has. This shouldn't be the case.
Comment #8
kenorb commented> ok, but it does show the same profile form (= the same content types) for all roles, right?
No, it showing different forms.
Probably I missed this patch: http://drupal.org/node/313341#comment-1237651 which was made few months ago and I though it has been committed already.
Comment #9
kenorb commentedPatch for latest dev.
It's still happen with latest dev.
Basically I'm using autoassignrole and I'm creating new profile for another user (when I'm logged in on some user), then instead of profile creation, I've got redirection to my own profile.
Some other example:
Roles available: company, parent
Company log in to his account and want to create another user with role parent (via autoassignrole). It's not possible without this patch because of hardcoded redirect.
Similar issues:
#330479: Working with Auto Assign Role
Comment #10
fago>Basically I'm using autoassignrole and I'm creating new profile for another user (when I'm logged in on some user), then instead of profile creation, I've got redirection to my own profile.
You can only create profiles for other users with administer nodes permission - this should work as is. I don't see what aar has todo with creating profiles for other users?
Comment #11
1kenthomas commentedI'm closing given the time. Reopen if necessary.