The check boxes to assign roles on subuser creation have disappeared in the latest dev release. Comparing the alpha and dev code it appears some of the code from the subuser_form_user_register_form_alter has been removed.

Current Dev code

function subuser_form_user_register_form_alter(&$form, &$form_state) {
  global $user;

  $form['subuser_relation'] = array(
    '#type' => 'checkbox',
    '#title' => t('User relation'),
    '#description' => t('Store a relationship that will allow for further management of the user.'),
    '#default_value' => $user->uid && variable_get('subuser_relation', TRUE),
    '#access' => $user->uid && user_access('override subuser relation'),
  );

  $form['#submit'][] = 'subuser_user_register_form_submit';
}

Alpha Code

  function subuser_form_user_register_form_alter(&$form, &$form_state) {
    global $user;

    // If the user does not have access to the roles field then filter the roles
    // field based on subuser permissions and display if more then one left. If
    // the user has 'administer permissions' then the #access will be set to TRUE
    // and they will have access to all roles, otherwise if the user has access
    // to this page through subuser then only provide them with the roles they
    // are allowed based on subuser. All users will have at least one role, but
    // that role may be 'authenticated user' which is not included in #options.
    if (!$form['account']['roles']['#access']) {
      foreach ($form['account']['roles']['#options'] as $rid => $role) {
        if (!user_access('create subuser ' . $rid)) {
          unset($form['account']['roles']['#options'][$rid]);
        }
      }
      $form['account']['roles']['#access'] = count($form['account']['roles']['#options']) > 0;
    }

    $form['subuser_relation'] = array(
      '#type' => 'checkbox',
      '#title' => t('User relation'),
      '#description' => t('Store a relationship that will allow for further management of the user.'),
      '#default_value' => $user->uid && variable_get('subuser_relation', TRUE),
      '#access' => $user->uid && user_access('override subuser relation'),
    );

    $form['#submit'][] = 'subuser_user_register_form_submit';
  }

Putting this bit back into the dev code appears to make everything work correctly but I'm not sure if this was removed on purpose or if there has been any changes that would require this be updated.

    // If the user does not have access to the roles field then filter the roles
    // field based on subuser permissions and display if more then one left. If
    // the user has 'administer permissions' then the #access will be set to TRUE
    // and they will have access to all roles, otherwise if the user has access
    // to this page through subuser then only provide them with the roles they
    // are allowed based on subuser. All users will have at least one role, but
    // that role may be 'authenticated user' which is not included in #options.
    if (!$form['account']['roles']['#access']) {
      foreach ($form['account']['roles']['#options'] as $rid => $role) {
        if (!user_access('create subuser ' . $rid)) {
          unset($form['account']['roles']['#options'][$rid]);
        }
      }
      $form['account']['roles']['#access'] = count($form['account']['roles']['#options']) > 0;
    }

Comments

littledynamo’s picture

I am also experiencing this problem - upgraded to dev and now there are no options to assign a role when creating a subuser.

aaronbauman’s picture

Status: Active » Needs review
StatusFileSize
new908 bytes

Not sure why "create subuser" role permissions are only exposed on the edit form.

In this patch:
- Apply the same logic to user_register_form to expose roles.

nagraj404’s picture

automatically Can't assigning parent roles to subusers , same working in D6 but not in D7

pooja.sarvaiye’s picture

StatusFileSize
new39.13 KB
new43.11 KB
new910 bytes

Minor fixes to comment - added ending period and changed few words

pooja.sarvaiye’s picture

StatusFileSize
new1.21 KB

Submitting again with correct file.

pooja.sarvaiye’s picture

StatusFileSize
new1.33 KB

Limited comment to 80 chars approx and modified other similar comment

pooja.sarvaiye’s picture

StatusFileSize
new1.34 KB
rteijeiro’s picture

Status: Needs review » Reviewed & tested by the community

Patch applies well and it fixes a couple of coding standards issues too. Screenshots provided in #4 seem fine. It's RTBC for me!

  • lauriii committed 3498b70 on 7.x-2.x
    Issue #2226641 by pooja.sarvaiye, aaronbauman, rteijeiro: Can't assign...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Lates patch is commited and pushed! Thanks for working on the issue! I created issue as a follow-up for this: #2509978: Automatically assign subusers on specific role because I really liked how clean the user creation form used to be before roles was there.

rteijeiro’s picture

Great, thanks @lauriii!! Let's see if @pooja can work in the follow-up too. We are going to use this module actively in our current project.

Status: Fixed » Closed (fixed)

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

DrCord’s picture

The patch in #7 worked for me, easy peasy!

DrCord’s picture

This actually ended up being a better solution, as I didn't want the user to be able to choose what role was granted but rather force it to be granted.

https://www.drupal.org/node/2509978#comment-10257663