1

I know actions can be done with Views Bulk Operations (VBO), but I just want a button in each row of a view of entities. When I press the button, the action is executed for that entity.

0

You could do this by writing a custom module:

The Button Field module also looks like it could help you do what you want: https://drupal.org/project/button_field

0

What you're asking for is perfectly possible using the Rules Link module (no need for VBO). Some details about this module (from its project page):

Features: ... The links are usually displayed using Views...

Usages: ... The Rules Link module will create a Views field for each link, which can be hidden, using the visibility conditions ...

However, assuming you're familiar with the basics of Views, it isn't obvious at first about how to actually add such extra column. The clue to get it to work, can be found in this part of the module's README.txt:

Rules Links link will create a Views field for each link, using the title of the link as title for the field. So if you have link for nodes with the delete 'Delete node', you'll find the Views field under name 'Content: Delete node'.

Example

Below is a list (= Views result) of "All blocked/active users" shown to a user with role Administrator:

User name      Active  Created date        Last login
Hillary.Trump  No      06/18/2016 - 13:45                      Unblock user
Donald.Clinton No      06/18/2016 - 13:42                      Unblock user
Someone.Else   Yes     05/12/2016 - 12:09  09/17/2017 - 11:18
Pierre.Vriens  Yes     03/11/2016 - 21:05  10/06/2017 - 16:04
Dries.Buytaert Yes     11/23/2015 - 10:11  09/17/2017 - 10:38
Anonymous      No

Note the extra column added (to the right), with links labeled Unblock user which are only shown for the blocked users, and not for Anonymous. After using (clicking) that link, for some user with Active=No, the user's status becomes Active (an example of "an action triggered on a user entity", as in your question), and the link is no longer shown for that user. If you wonder how to create such extra column (using Rules Link), refer to my answer to "How to show authorized users a link for relevant Views results using the Rules Link module?". Obviously, transforming such link into a button is just a matter of some (basic) CSS to be applied to that link.

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.