Download & Extend

Where do I assign profiles to a role?

Project:TinyBrowser
Version:7.x-1.0
Component:User interface
Category:bug report
Priority:normal
Assigned:pixture
Status:active
Issue tags:profiles, roles, settings, tinybrowser

Issue Summary

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.

AttachmentSize
tinybrowser_settings.png150.04 KB

Comments

#1

Assigned to:Anonymous» pixture

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.

AttachmentSize
ss-tinybrowser-settings.jpg 60.25 KB

#2

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.

AttachmentSize
tinybrowser.module-2011-02-22.patch 656 bytes

#3

Issue tags:+profiles, +roles, +settings, +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.

#4

> @numskull

I will look into the warning thing.

nobody click here