Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi!
I`m added Action "Modify user roles" and active this action in Quiz node. If test completed I have error:
Fatal error: Unsupported operand types in *.ru/sites/all/modules/views_bulk_operations/user_roles.action.inc on line 62
How I can solve this problem?
Comment | File | Size | Author |
---|---|---|---|
#4 | 822202.patch | 680 bytes | infojunkie |
Comments
Comment #1
GameCharmer CreditAttribution: GameCharmer commentedSame issue persists with current version on line 69. Issue still persists on dev version at line#61.
Previous post in the quiz module issues queue: http://drupal.org/node/1083346
Comment #2
infojunkie CreditAttribution: infojunkie commentedI don't understand the context. "Modify user roles" applies to users, not nodes. What's the connection to Quiz module? Can you reproduce this in the context of normal page nodes?
Comment #3
GameCharmer CreditAttribution: GameCharmer commentedWhen a user completes a quiz and passes, the quiz module calls the action "Assign User to X Role", where X is a custom role I set up to allow users to post content. Basically, you can register but not post content unless you can pass a test, which is more or less just a basic "Do you understand not to do this and that" kinda thing.
I'm trying to fire an action on completion, but it is crashing out on me.
I updated to the latest revisions and still got the issue. I then upgraded to the dev versions and I get the same issue, just a different line number.
Fatal error: Unsupported operand types in /home/gcworld/public_html/sites/all/modules/views_bulk_operations/user_roles.action.inc on line 70
Comment #4
infojunkie CreditAttribution: infojunkie commentedPlease try the attached patch. Does this work fix it?
Comment #5
GameCharmer CreditAttribution: GameCharmer commentedThat eliminated the error message, but the role still isn't being assigned. That patch shouldn't be necessary as it's listing roles to add, and if there are no roles to add, despite being a role add action, it should throw an error, although probably not a WSOD with the message...
I'm a bit stumped as to what is causing this.
Comment #6
infojunkie CreditAttribution: infojunkie commentedDoes calling the same action from VBO work for you?
Comment #7
GameCharmer CreditAttribution: GameCharmer commentedNo clue now to directly call an action from VBO. I don't think I even have an ACP panel or whatever for VBO.
I can use the user control panel to easily add roles to the users, so I know the role itself is working just fine.
Comment #8
bojanz CreditAttribution: bojanz commentedThere's still a patch in here.
Comment #9
bojanz CreditAttribution: bojanz commentedJust marked #1275450: BUG? Fatal error: Unsupported operand types when trying to add a new action related to add a new role to a user as duplicate. The patch fixed the error in that case, but adding the role still fails, so I'm changing issue status.
Comment #10
Rosamunda CreditAttribution: Rosamunda commentedsubscribing :)
Comment #11
bojanz CreditAttribution: bojanz commentedOkay, I've taken a look at this.
This is a problem in the Quiz module. I guess when the action is run from Quiz, $context['add_roles'] is empty, hence no roles being added.
And $user->roles is always supposed to be an array, so Quiz might not be passing the right object at all (or not formatting it correctly).
I have no knowledge of the Quiz codebase, so I can't help further. Do a dsm($user); dsm($context); to see what data gets passed, then open an issue in their queue.
Comment #12
caspervoogt CreditAttribution: caspervoogt commentedThis patch alone didn't work for me.. in my case the specific error was:
"Fatal error: Unsupported operand types in /home/www.mysite.com/public_html/sites/all/modules/views_bulk_operations/actio... on line 71"
Line 71 was:
I changed this to:
That worked for me. In my case the fatal error meant that user registering on the site could not get subscribed to our Simplenews newsletters. This fix plus the patch above worked for me.
Comment #13
marleo CreditAttribution: marleo commentedI'm trying to fire an action to modify user roles from a quiz. The above patch stopped my WSOD at the end of the quiz, but didn't update the user role and also I got this error:
warning: array_push() expects parameter 1 to be array, null given in /path/to/sites/all/modules/views_bulk_operations/actions/user_roles.action.inc on line 72
D6.28
Quiz 6.x-4.4
VBO 6.x-1.16
Comment #14
caspervoogt CreditAttribution: caspervoogt commentedsounds like $roles is not getting set. Maybe try this, though I have not tested this:
Or ...
Also maybe try replacing "$roles = array();" with "global $roles;" .. not sure about that though.