Closed (fixed)
Project:
Toolbar
Version:
6.x-2.3
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Sep 2010 at 12:21 UTC
Updated:
22 Mar 2011 at 15:56 UTC
Jump to comment: Most recent file
Comments
Comment #1
dankh commentedOn toolbar install, example/sample toolbar is created (set-default) and the toolbar is assigned to the user that installed the module. In the most common case ("user 1" installs the module),toolbar_user table has only 1 entry :
The anonymous user has id 0. This is the expected behaviour of the module if you have created a toolbar and enabled it for the anonymous user (uid=0). This is not a bug, the toolbar can be configured to be visible for anonymous users. Also you don't need to manually edit the database record, you can change the per role permissions at admin/settings/toolbar and deactivate the toolbar for anonymous role.
The toolbar is visible even for anonymous users, until I manually change the value in the table to uid=1
What is the context in which you run _toolbar_set_user_toolbar ? Do you provide a valid $user object to _toolbar_set_user_toolbar ? Do the anonymous user can run the action which triggers _toolbar_set_user_toolbar ? If it's not much pain can you paste some code.
Thanks,
Comment #2
ldweeks commentedThanks for your work!
I have run into the same problem. It occurs when the toolbar module is installed via an installation profile. The only custom code that I have that includes anything about the toolbar module is in my installation profile. In my function HOOK_profile_modules, I simply list 'toolbar' as one of the modules that it needs to enable. Thats it.
My guess is that the "user" that is active during a drupal installation is the anonymous user. Here's what I did to test: I noticed that you make a call to _toolbar_set_user_toolbar() from within toolbar_install() in your toolbar.install file. I simply removed the call to _toolbar_set_user_toolbar, and that fixed the issue for me.
I'd recommend that you simply remove those lines from your install file. It means a tiny bit more work for the admin user, but I think it's a better solution.
I've attached a patch...
Comment #3
ldweeks commentedSorry... forgot to mark this as needs review.
Comment #4
dankh commentedI don't know much about installation profile development, but the only reasonable conclusion (as you stated) is that there is no $user available when installation profile enables modules.
There is another question hidden in this issue, do we need default/example profile created on install. I'll create an issue for that.
Patch accepted.
Thanks for your work on this.
Comment #5
dankh commented