0

I want to add a custom VBO action.

It display in the actions list of the view, it should like a tree, like this:

-Add Role-

RoleA

RoleB

-Remove Role-

RoleA

RoleB

And When I select RoleA(-Remove Role-), check some users, click the submit.

The users checked should be removed RoleA.

How can I code a custom VBO action like this ?

-1

You can create custom VBO action by implementing hook_action_info() hook. Here are some useful links which can help you achieve what you want:

  1. Views Bulk Operations development guide (Drupal 7)
  2. Programmatically adding and removing roles to users in Drupal
  3. HOWTO assign a user to a role programatically

additionally, Examples module can help you to learn about Actions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.