1

I have a VBO of all the unpublished nodes of the user, and I want to publish all of them based on user role change that happens via Rules.

I created a component of rule to list the nodes of that user but since my Event is After updating an existing user account in my actions section, when I add the component, there's no Node related parameters to pass so I can publish those nodes.

Update: Pierre's answer actually defines the steps that I've already taken, the last part that puzzles me is that how can I add the component to be triggered to an After updating an existing user account event where there's no node defined in it.

1

What you actually need to do is similar to what is shown in the video about Using VBO to load list of objects into Rules, starting from about 5:30, up to 11:30. Here is a summary of what is shown in this video (quote from the linked page):

  • You need a view that lists the entities you want to work on in Rules. Note that you don't need a display of the view – and it might even be better not to have one if you don't want the view to be displayed somewhere.
  • However, you need one bulk operations field. The type of bulk operations field determines what entity type will be sent to Rules. Note that you don't need any actions enabled for the field – it is enough that it is present.
  • You need a rule that, as an action, loads entities from a VBO. (This is available under the "Views bulk operations" group.) All view displayes with at least one VBO field will be selectable.
  • The action provides a list of entities, that can be used just like other lists in Rules. Combine with loops, actions and Rules Scheduler to make awesomeness happen.

In your case you want to start from your VBO list of the unpublished nodes of the user. And for each node in the list you want the rules action to be "publish node" (instead of "remove sticky").

You want to pass the userid as a parameter also, similar to what is shown around 7:30 in that video also. I'm assuming your VBO view also requires the userid already.

The Rules component that you create as described above, should then become the action to be performed by a rule that is triggered by the event "After updating an existing account". This is what differs from what is shown in the video, starting from 11:30 (in the video the Rules component is triggered daily, via the Rules Scheduler).

Should you need any other rules "conditions" (eg: only for selected roles), you can add them to the rules component you created.

  • Thanks for answer Pierre, I've already watched the video, it is a helpful one of course, as you mentioned it's almost the same situation, but because I need to trigger the rule on "After updating an existing account" then I cannot add my component to the rule that I have created since there's no node defined in event, but still I have no solution for this and that's what I'm looking for. thanks a lot again – Sohail Sep 12 '15 at 18:15
  • It seems something is wrong with your "VBO list of the unpublished nodes of the user" ... Since you want the rule to be triggered after event "After updating an existing account", the "uid" of the updated account must be available. And with that "uid"-value, your view should be able to build a list of unpublished nodes for that uid I think, or am I missing something? Can you edit your question to provide more details on the view you created, i.e.: (a) the fields in the view, and (b) how this view uses the "uid" and (c) the VBO field in the view? I think with that we can find the missing piece! – Pierre.Vriens Sep 13 '15 at 7:45
  • Hey @Sohail, no more progress / news on this? Did you get it to work? – Pierre.Vriens Sep 15 '15 at 13:22
  • Hey Pierre, thanks for the follow up, currently I'm on a vacation and can't really get into this issue, I'll look into this as soon as I get back next week. thanks anyways – Sohail Sep 15 '15 at 16:57
  • 1
    Thanks for the "update", enjoy your vacation! Add a ping-comment around here whenever you want to come back on it. – Pierre.Vriens Sep 15 '15 at 16:58

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.