When an Administrator create a new user - the profile is being stored in the database with uid = 0 and revision_uid = admin uid. I tried to play with module weight in system table with no success. within hook_user() the $account object represents the new user correctly, but hook_nodeapi() sees $user as currently logged in user (administrator).

Also would like to point that hook_nodeapi() gets called before hook_user() - meaning $account is empty at the profile creation page.

Could someone confirm that they have fully functioning module when admin creates a new user?

Also a note to the module author to look into the problem.

Comments

piyushbagri’s picture

subscribe

prhodes’s picture

Yes, I am experiencing this same issue myself.
Subscribe+

Update:
Using content_profile-6.x-1.x-dev
NO record inserted at all in the content_type_profile table.

fago’s picture

Status: Active » Postponed (maintainer needs more info)

>When an Administrator create a new user

Are you talking about the registration integration or what?

BaskingShark’s picture

Same issue, discovered when unable to save edits as described in http://drupal.org/node/543104

Here's my description from that bug: it looks like when creating/editing a profile as an administrator the uid passed to content_profile_profile_exists and inserted into the node table is 0... which is why it keeps saying the profile already exists. Once any administrator creates a profile for any user it is written to the node table as type "profile_name" and uid "0" -- it's then inaccessible to everyone and starts blocking all further admin profile adding/editing.

ivrh’s picture

Status: Active » Postponed (maintainer needs more info)

To #3. Not sure what you mean about registration integration. I am administrator and I create a new user. This is when the problem happens. The module works fine for new users registering themselves.

ivrh’s picture

Status: Postponed (maintainer needs more info) » Active

Change status

rickh’s picture

Status: Postponed (maintainer needs more info) » Active

I'm having the same problem here. Admin can't create new profiles, authenticated users can create an account perfectly but when any editing or adding of profiles is done by the administrator the account becomes anonymous. Has there been any solutions on this yet? I'm a bit stuck so any help would be appreciated.

Thanks

rickh’s picture

any help on this guys?

bentonboomslang’s picture

Subscribing (there seem to be a number of threads with this problem). It seems a pretty important one.

hansrossel’s picture

Version: 6.x-1.x-dev » 6.x-1.0-beta4

I had the same problem and could solve it as follow:

My setup:
- profile information is requested on user registration, so user and profile get created in the user/register form
- anonymous users can create profile content (set in permissions): I start doubting if thats needed, but thought so because its an anonymous user registering and completing the profile data on user/register

Problem as above:
- when an admin creates a new user+content profile on admin/user/user/create there is the error "This user has already a content profile of this type. You can only create one profile per user". Admins cannot create users anymore.

Cause:
- I found in the logs one user that registered and that had during the registration (so on the same minute) created two content profiles: one correctly assigned to the user as author and a second one with the same data but assigned to anonymous as author. I suppose this user was not very patient and pressed the submit button a second time during registration which caused the second wrong content profile being created.

Solution:
- Deleting the wrong/corrupt content profile (assigned to anonymous) that the impatient user had created solved the issue. Apparently that content profile is blocking all other user/profile creation when it exists.

I'm wondering if the permission to create a content profile for anonymous users might have made this possible to happen.

rickh’s picture

How can you not give an anonymous user the permission to create a profile, when you have a social networking style site. I cannot create every profile, because i want users to create their own. Maybe I'm not completely understanding this, but any help would be appreciated.

hansrossel’s picture

A content profile is a content type that has a certain user as author, so it should not be made by anonymous users. When first a user registers and then in the next form creates his content profile there is no problem and we don't need to give permissions to anonymous users to create content profiles. The user is at the moment he creates the content profile an authenticated user.

When the permission "create content profile" is given to anonymous users a user that is not logged in can go to node/add/[name-of-contentprofile] and make a profile that is not connected to any user (= that is owned by "anonymous").
What happened in the double submit is that such a profile is created, so I think not giving anonymous users the permission to create a content profile could prevent this from happening. So I'm curious if the others that have this issue also have given permission to anonymous users to create a content profile.

rickh’s picture

You are absolutley right, but I never had the pemission set for anonymous users. This has also not affected the above for me at all. It brought back my anonymous user pictures but has had no affect on admin being able to edit or add profiles, including their own.

hansrossel’s picture

@rickh: could you confirm you also have 1 content profile that is assigned to Anonymous (which is uid=0, I'm not sure which anonymous user pictures you talk about), and that if you delete that one an admin can again create content profiles for users?

rickh’s picture

i don't have permissions set so that anonymous users can create profiles and admin cannot create any profiles as they become anonymous profiles. I do believe this might be a problem with the realname module, as the option is not given to create a username for the user, when the profile is cretead. I believe the realname module is making things go a bit nuts, therefore i'm of no help to you further. sorry about that. thanks for the help, but I think we are on two different levels here.

hansrossel’s picture

I'm not using realname, in my case it was just one wrong/corrupt content profile blocking the creating by admins. Removing that one solves all problems.

Just disable Realname module and see if it works then if you think it's that module. If it works again when disabling the realname module, you better go to that issue queue with your bug, there seem to be quite a bit bugs allready there: http://drupal.org/project/issues/realname?categories=bug.

YK85’s picture

subscribing

johnlutz’s picture

subscribing

fago’s picture

Version: 6.x-1.0-beta4 » 6.x-1.x-dev
Priority: Critical » Normal

I just created manually a profile assigned to the anonymous users and test adding a new user with the profile-creation form added. It worked fine for me though. Any steps to reproduce? Also please make sure to test the latest dev snapshot.

Setting priority to "normal" as that feature isn't that common.

u4yk’s picture

I run into this issue when I try to update a content profile using a custom form. Now, when I use the base form, it works fine; it's just when I use a custom form, it sets the uid to 0 and the title to an empty string in the node table. Anyone have a solution?

agogo’s picture

Status: Active » Needs review

fago: I do not agree that this issue should be prioritized as normal.

Several issues are mentioned above but the main and original issue, as I can see it, still is this:

When logged in as administrator (ex. uid 1) and creating a user profile node for any other user than him/her self -> the node uid field sets to zero (0) instead of the user id of the intended user.

This makes it impossible to create user content profiles for an administrator.

Ive taken a look at the code for the module and believe the function content_profile_form_alter() in content_profile.module should work. Looking further i made it work by just changing the author form value that is changed for administrators:

File: content_profile.module
Function: content_profile_form_alter()

On line 283:
From:
$form['author']['name']['#default_value'] = $user->name;
To:
$form['author']['name']['#value'] = $user->name;

Since the change is so trivial I didnt make a patch, I hope thats ok this time.

julien.reulos’s picture

As admin, when i created a new user (with the Content Profile User Registration module activated), the user was created, but the Content Profile module node was not saved.

I apply the patch #21 and now it is working. Thanks Agogo!

YK85’s picture

Status: Needs review » Reviewed & tested by the community

subscribing - had the same issue. Thanks for the fix!!

fago’s picture

Status: Reviewed & tested by the community » Needs work

>$form['author']['name']['#default_value'] = $user->name;
I don't see a problem with that approach, maybe another module is chiming in and causing your problem? Do you see the right author name in the form?

Also, please always roll proper patches.

damienmckenna’s picture

I'm experiencing this on a website. In my case the user account is not created but the content profile node is created with the uid of 0.

anaperes’s picture

Hello
I have this problem as well and I tried to used fix Agogo gave and didn't work for me.
I'm using drupal 6.2; content profile 6x-1.0; cck 6x-2.9; compact forms 6x-1.3. I saw in another issue similar to this case and they said could be form filter I also don't have.
Help please??
Regards.

millenniumtree’s picture

I had this issue because I wasn't printing the $form['author'] field to the page in my theme's node form template.

I made the patch in post #21, which did help me fix the problem, but it turned out to be NOT NECESSARY once I fixed my node_form.tpl.php!

Check the node_form.tpl.php file in your template and make sure you haven't done anything weird with it. In my case, I was condensing several fields into a fieldset called 'Advanced', but I had made a mistake which prevented the fields from printing.

Here's what my node_form.tpl.php looks like. I had mistakenly not printed the results of "drupal_render($form['author'])".

  //Render the advanced options
  if ($author = drupal_render($form['author'])) $advanced .= "<div class='authored'>\n{$author}</div>\n";
  if ($options = drupal_render($form['options'])) $advanced .= "<div class='options'>\n{$options}</div>\n";
  $advanced .= drupal_render($form['revision_information']);
  $advanced .= drupal_render($form['comment_settings']);

  if (!empty($advanced)) {
    $advanced = "<div class='advanced-options'><fieldset id='fieldset-advanced-options' class='collapsible collapsed advanced standard'>\n"
      ."<legend>Advanced Options</legend>\n"
      ."<div class='fieldset-wrapper'>{$advanced}</div>\n"
      ."</fieldset></div>\n";
  }

  // Render the buttons, so we can put a div wrapper around them
  $buttons = "<div class='buttons'>".drupal_render($form['buttons'])."</div>";

  // Everything else gets rendered here
  $standard_options  = "<div class='standard-options'>".drupal_render($form)."</div>\n";

  print "<div class='node-form'>{$standard_options} {$advanced} {$buttons}</div>";
aaronbauman’s picture

Version: 6.x-1.x-dev » 6.x-1.0
Status: Needs work » Fixed

Replicated OP on 6.x-beta4 and confirmed fixed in 6.x-1.0

millenniumtree I think you have run into a separate issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

rofsky’s picture

Status: Closed (fixed) » Active

Fago, I still have this problem, on 1.0 and dev.

When editing a profile node logged in as super admin everything works fine, when logged in as another user with admin role, the node profile goes in as a guest and is not attached to the user.

Tried #21, does not fix, in dev code the line for that would be 276.

Any ideas?
----------------------
Update

Ok, After further testing, I noticed that if the form filter module is hiding the author field this happens. I still have the above change from #21 applied, and when displaying the author info everything is fine.

Do you think this is something to submit into formfilter?

beneetha’s picture

Issue summary: View changes

I am facing the same issue....I have created profile using profile2 module. But when admin creates profile the data is not coming proper. Shows blank when the user loggs in .............Any solution???