When I hit 'edit' for a subuser, I'm only able to access and modify the basic account information - the menu allowing me to edit profile categories is missing.

The menu appears as normal when logged in as the subuser.

Comments

Erica_der_Whatkin’s picture

More info:

I'm using Drupal 6.15, and the problem only seems to occur when I'm logged in as a user who has Administer subusers privileges, but not Administer Users privileges.

Jackinloadup’s picture

Same issue

Jackinloadup’s picture

nevermind, I'm dumb. I didn't have Administer subusers privilege on the correct role.

puravida’s picture

I have the same issue (and not because of "administer subusers"). I have allowed the proper role to "create subusers" and "administer subusers". However, once created, only the basic information is shown by clicking "edit" for that subuser.

If I check the "user" permission for "administer users", then the profile fields will display. However, this creates an even worse issue that anyone in that role can edit anyone else's subusers (if they are clever enough to modify the UID in the URL), which is unacceptable.

Can anyone please take a look at this and consider fixing the bug (if it's a bug) or adding an option for "administer own users"??

Many thanks,

Brandon

puravida’s picture

Quick update. I spent the last few days upgrading everything to Drupal 7 and finally got everything back to where I was on D6.

Now, I see that I still have this same issue. The edit/delete will only show for the UID1 user, unless I assign "administer users" permission to another role. I wasn't sure if you wanted me to open a new ticket specifically for the D7 version (7.x-2.0-alpha1, May 04, 2011) or not.

Cheers,

Brandon

puravida’s picture

Nevermind. I completely forgot that I saw this issue: 1145350 - Finish 7.x-2.x port and that already told me that edit/delete isn't working yet. :)

dpantele’s picture

The reason is that parent user doesn't have any access to the nodes authored by subuser.

Maybe, an access hook for several node types should be written? Or we should give edit access only for node which are profiles?

arcaic’s picture

If anyone is getting this issue then check if the subuser account has ever been logged in.

There is a check in core that will not allow the users account details to be viewed if the account has never been accessed (some issue about spamming apparently). This might be causing the problem for some.

There is a simple fix you can place in your own custom module that simple sets the 'accessed' value to that of the 'created' when the account is created. http://drupal.org/node/614688. Although the fix is set as v7 it works for 6 as well.

Took me two days to find the issue and once I found it 2 minutes to find out its been known about for ages. :-|

I think maybe the subuser module could employ the fix above possibly with a tick box in the settings that lets you choose whether to see use it or not.

Andy

smartsystems160’s picture

i got this error too, but when i create the subuser and "switch" to the subuser account, then log out back to the parent account, then i can edit the subuser. seems the "switch" assumes that the user has logged in.

Update: Temporary workaround without coding: Once you create a subuser, click the "switch to subuser" link, then switch back to your parent account, you'll be able to edit the subuser

knsheely’s picture

I have this same issue and it appears to me to be an access issue in the profile module.

The subuser module uses hook_menu_alter to change the access of 'user/%user_categories' (subuser.module line 93) to its own subuser_user_edit_access (line 104). This allows the user_profile_form to be displayed to the parent with the correct 'administer subusers' permissions. This works great for displaying the basic information, however it does not display the profile fields because the profile_category_access function (profile.module line 474) still uses user_edit_access to display the fields.

I can get the fields to display if I hack the profile module to change line 474 to

    return subuser_user_edit_access($account) && db_result(db_query("SELECT COUNT(*) FROM {profile_fields} WHERE category = '%s' AND visibility <> %d", $category, PROFILE_HIDDEN));

.

I am still searching for a non-hacked solution. Any help would be appreciated

knsheely’s picture

I found another roundabout solution. Here it is:

1. Install Profile Access module
2. Make sure all roles are editable by the administrator at admin/settings/profileAccess
3. Grant administer users permission to all roles who should be able to edit any user.
4. In your module Create a new page with hook_menu() where you want your edit page to live. In my case I used 'user/%user_categories/subuser/%/edit' where %user will load the parent user and % will be the subuser's id.

function mymodule_menu() {
$items['user/%user/subuser/%/edit'] = array(
      'title' => 'Edit User',
      'description' => 'Edit subusers',
      'page callback' => 'mymodule_subuser_edit', // callback function checks for access
      'page arguments' => array(1, 3), // adds arguments to callback function
      'access arguments' => array('administer users'),
      'type' => MENU_CALLBACK
  );
  return $items;
}

function mymodule_subuser_edit($parent = null, $uid = null) {
$parent_id = subuser_get_parent($uid);
  if ($parent->uid == $parent_id) {
    $user = user_load($uid);
    include_once drupal_get_path('module', 'user') . '/user.pages.inc';
    return drupal_get_form('user_profile_form', $user, 'account');
  } else
    return "You are not allowed to edit this user.";
}
lauriii’s picture

Issue summary: View changes

I would appreciate to see a patch about this issue

nancydru’s picture

@knsheely: How is your menu path invoked? It is certainly not by the Views edit link handler.