The per-role configurations do not work correctly. For example, if I assign a menu to the "adminstrator" role, the configuration options for that role have no effect—I have to instead edit the configuration options for the "authenticated" role.

Comments

bocaj’s picture

Status: Active » Postponed (maintainer needs more info)

I'm not seeing this issue. Do you perhaps have the authenticated user role listed higher than your other role(s) at admin/config/user-interface/quickbar? Since every user is in the authenticated user role then, if this is above the other role(s) in the table, all of the settings for authenticated user will be caught and not for the specific role you are trying to target.

dboulet’s picture

No, the "administrator" role is first in the list. Assigned menu for the "administrator" role is "Management" and assigned menu for "authenticated user" is "none".

bocaj’s picture

Status: Postponed (maintainer needs more info) » Active

Yeah, the more I'm playing with things I'm starting to see this issue crop up. I can't exactly put my finger on it though. It seems like if I manually order the roles, then it works, but if the role weights have been altered then there's some issues. But, I'm also seeing some issues after I've adjusted the role weights. I'm not sure exactly what's going on here. I will look at it again when I have a span of time to allot into looking into it further. It's not jumping out at me with a quick look.

Of course, if you make any progress on it, please let me know! Thanks!

redndahead’s picture

After this one is figured out then I want to roll a beta2 release of 2.x and make the 1.x final. I'm tagging some issues as release blockers for the 2.x release.

redndahead’s picture

ldweeks’s picture

When I found your module, I wanted to buy you a good, hard drink. Thanks *so* much for working on this. It's awesome, and I looked for a long time before finding it.

I'd be happy to test this issue some with a few more pointers.

bocaj’s picture

Status: Active » Postponed (maintainer needs more info)

I have tested both 7.x-1.0 and 7.x-2.x and cannot get this issue to come up again. I have moved the roles at admin/config/user-interface/quickbar to many different positions and have set various different options for each role and I am getting the options I set for the role that is highest on the list that pertains to the logged in user.

Is anyone else still having this issue with the latest devs? Nothing in the recent commits would affect this issue that I know of, but (as stated in #3) I do remember this issue popping up when I was looking into it then. It's odd now that I cannot reproduce it. Both branches on my test site are updated to the latest dev releases.

dboulet’s picture

Status: Postponed (maintainer needs more info) » Active
StatusFileSize
new62.57 KB
new72.34 KB
new71.6 KB
new49.85 KB

Maybe some screen shots will make things clearer. These were taken as user 1, using the latest code from git.

Choosing a menu for administrator works as expected.
Choosing a menu for “administrator” works as expected.

Yet, the configuration options for administrator have no effect.
Yet, the configuration options for “administrator” have no effect.

I have to instead change the configuration for authenticated user.
I have to instead change the configuration for “authenticated user”.

The menu is being taken from administrator but the configuration is taken from authenticated user.
The assigned menu is taken from “administrator” but the configuration is taken from “authenticated user”.

bocaj’s picture

OK. After looking into this more from the screenshots @dboulet posted, I have rolled a patch that will hopefully take care of this issue. It seems like the issue revolves around the icons (which @dboulet's screenshots point out). Since I never use icons, and didn't think to test them, I wasn't seeing that issue.

Please apply this patch and let me know if this works (patch for 7.x-2.x). I have tested it with multiple different configurations again on a clean install of Quickbar and it appears to work.

Also, I didn't notice any issues with any of the other configuration settings. Although, since it appears like the icon issue was due to a role weight bug, those might be fixed as well if there were any.

You will notice some css changes in the patch as well. That is to fix some issues that cropped up when I changed around the weight handling. Just noting that this patch is for only this issue.

bocaj’s picture

Status: Active » Needs review
redndahead’s picture

Status: Needs review » Needs work
+++ b/quickbar.admin.inc
@@ -150,6 +151,14 @@ function quickbar_form_submit(&$form, &$form_state) {
+  if (!variable_get('quickbar_role_weights')) {

This is missing the second parameter of variable_get

+++ b/quickbar.admin.inc
@@ -216,6 +225,23 @@ function _quickbar_configure_page($rid) {
 /**
+ * Quickbar default weights.
+ */
+function _quickbar_default_weights() {
+  // Get the user roles
+  $roles = user_roles();
+  $rids = array_keys($roles);
+  ¶
+  $default_weights = array();
+  foreach ($rids as $rid) {
+    $default_weights[$rid] = $rid * -2;
+  }
+  ¶
+  asort($default_weights);
+  return $default_weights;
+}

Not so sure on this function, but if I don't get to a good review in time and it works I say go ahead.

dboulet’s picture

Status: Needs work » Needs review

Haven’t had time to really study the code in the patch, but it does apply cleanly and seems to have solved the problem: configurations are now properly applied.

One issue that I did find was that after applying the patch and re-saving the order of the roles, the order was reversed and I had to re-adjust them.

bocaj’s picture

Status: Needs review » Needs work

Hi @redndahead!

In D7 variable_get() doesn't need a second parameter (NULL is default, which is fine for this check: http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/variab...). To be consistent with the rest of the variable_get() calls in the module though, I will add a second parameter.

The reason for the _quickbar_default_weights() function is because if no weights are set (which is obviously the case when the module is first installed or if the admin never changes the order) then very weird things happen that affect the configuration settings (because the weights virtually aren't set). This function takes the role ids and multiplies them each by -2 so that the anonymous user role is weighted heaviest, followed by the authenticated user, then the administrator role, and so on. Of course, this is just a default setup and can be changed based on site needs. Setting all of the weights to 0 though was causing a lot of issues. I'm definitely open to another approach, that is just the one that I came up with when trying to debug the issue.

Maybe it would be better if the quickbar_role_weights variable was set when the module is enabled instead. That might make more sense then the way I currently have it setup.

bocaj’s picture

Status: Needs work » Needs review

Oops, our posts got crossed...

In reply to #12, I'm not sure why your roles got reversed after applying the patch. Did you set role weights before applying the patch or did you just leave them at their default settings?

bocaj’s picture

Here is an updated patch. This addresses @redndahead's mention of the variable_get() issue as well as resolves a notification that was popping up if the quickbar_role_weights variable was not set.

jefkin’s picture

@bocaj not sure why your patch failed on me bocaj, but it happened on the css. I moved the new css link line up in the file as I think my patch and git's patch didn't like the notice about

\ No newline at end of file

So, since I'd like to see some progress if possible, or at least a patch that works right for my upcoming deployment, I tried both methods of applying the patch, but only the by-hand-worked.

However, I built the changes by hand and tested it -- here's a reroll of your patch, that might work better?

  • redndahead committed 236511e on 7.x-2.x authored by bocaj
    Issue #1368728 by bocaj, jefkin: Configuration options per role do not...
redndahead’s picture

Issue summary: View changes
Status: Needs review » Fixed

This was committed.

Status: Fixed » Closed (fixed)

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