I am using TinyBrowser for the first time in Drupal 7. This may be a user error, but I can't figure out how I associate a profile to a user role. As you can see on the screenshot, I have 3 different profiles created, but the only one assigned to a role was the default admin profile. Shouldn't there be a link down where it says Assign profiles to user roles? It shouldn't be a permissions issue, as I'm logged in as admin.

Any help is greatly appreciated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pixture’s picture

Assigned: Unassigned » pixture
FileSize
60.25 KB

This is a bug and need to be fixed. I will look into it and fix ASAP. Sorry for the inconveniences.
As you can see in the attached image, UI is supposed to be added to the Role-Profile assignment section.

pixture’s picture

Please apply the attached patch to fix the issue until the new version is released.
Only one line change. If you are not sure how to use patch, please change the code as follows.

Before (tinybrowser.module line #1130)

function tinybrowser_sorted_roles() {
  static $sorted;
  if (!isset($sorted)) {
    $sorted = array();
    $member_only = TRUE;
    $roles = user_roles($member_only);
    $profiles = variable_get('tinybrowser_profiles', array());
    $rp = variable_get('tinybrowser_roles_profiles', array());
    // $rp[DRUPAL_ANONYMOUS_RID]['weight'] = 12;
    $rp[DRUPAL_AUTHENTICATED_RID]['weight'] = 11;
    foreach ($roles as $rid => $rname) {
      // cast (array) below suppress the warning of array_merge().
      $sorted[(array)$rid] = array(
         'name' => $rname,
        'weight' => isset($rp[$rid]['weight']) ? $rp[$rid]['weight'] : 0,
        'pid' => isset($rp[$rid]['pid']) && isset($profiles[$rp[$rid]['pid']]) ? $rp[$rid]['pid'] : 0,
      );
    }
    uasort($sorted, 'tinybrowser_rolesort');
  }
  return $sorted;
}

After

function tinybrowser_sorted_roles() {
  static $sorted;
  if (!isset($sorted)) {
    $sorted = array();
    $member_only = TRUE;
    $roles = user_roles($member_only);
    $profiles = variable_get('tinybrowser_profiles', array());
    $rp = variable_get('tinybrowser_roles_profiles', array());
    // $rp[DRUPAL_ANONYMOUS_RID]['weight'] = 12;
    $rp[DRUPAL_AUTHENTICATED_RID]['weight'] = 11;
    foreach ($roles as $rid => $rname) {
      // cast (array) below suppress the warning of array_merge().
      // $sorted[(array)$rid] = array(
      $sorted[$rid] = array(
        'name' => $rname,
        'weight' => isset($rp[$rid]['weight']) ? $rp[$rid]['weight'] : 0,
        'pid' => isset($rp[$rid]['pid']) && isset($profiles[$rp[$rid]['pid']]) ? $rp[$rid]['pid'] : 0,
      );
    }
    uasort($sorted, 'tinybrowser_rolesort');
  }
  return $sorted;
}

I will release the new version with this fix sometime this weekend.

numskull’s picture

Issue tags: +settings, +roles, +profiles, +tinybrowser

I have the same problem on my Drupal 7 site, and the posted fix worked. Thanks! Awesome module! NOTE: I still get the array_merge() warning on the "Add new profile" page, even after updating to 7.x-1.1.

pixture’s picture

> @numskull

I will look into the warning thing.