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 want to create rule that will allow adding multiple content to selected group audience.
Basically I have content type that is "Group content" and I want to set group audience to large number of nodes via VBO.
I figure out that I should use Rules Components, but I'm not sure what data types should I use (maybe Node and List of oG membership items?) and what actions should I use, maybe "add entity to a group"?
Could you please give me some tips?
Thanks
Comments
Comment #1
Rosamunda CreditAttribution: Rosamunda commentedHave you solved this?
Comment #2
rolkos CreditAttribution: rolkos commentedYes, it's not most elegant way. In Rules Component:
Variables: Node, List of node items as parameter
Condition: Enity has field > og_group_ref
Action: Loop > paremeter: list of node items
in loop action "Add entity to group", Data selector "node" (parameter), Group data selectro Group id-list.
Then I added this action to my node list view (vbo), and I paste grops nid as a argument, it would be better to have some nice widget, but run this only once so I used view to list nid that are groups.
Exported component:
Comment #3
Rosamunda CreditAttribution: Rosamunda commentedTHANK YOU VERY MUCH FOR SHARING YOUR SOLUTION!!!
Really appreciate it!
Comment #4
Yuri CreditAttribution: Yuri commentedadding the group ID manually isn't really a solution, more like a workaround.
Still looking for a proper way to accomplish this.
Comment #5
Miranda_NS CreditAttribution: Miranda_NS commentedI'm with that. I've tried to show the VBO on the group page and pass the Nid into the VBO to automatically assign selected content to the group. Can't figure out how to do it...
Comment #6
Yuri CreditAttribution: Yuri commented@miranda_ns As a workaround using VBO, I used a patch that fetches a views argument as an 'integer' parameter in rules. In that way you can create a views argument for current group from context the usual way, and set the argument in VBO settings.
In that way you can create vbo views of content and bulk add them to the current group thats in the group context, even on group content pages.
However, still a workaround. Current issue 'Add entity to group' is not working for me like it should.
What I did is instead of using 'add entity to group', just use rules to copy paste the field value of the current node from url (and make sure the view is in a group content node of course)
See https://drupal.org/node/1967702