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.
It would be much more flexible if the node would be published through an action in the Rules interface instead of in the commerce_node_checkout_publish_associated_nodes callback. This way you can easily change what happens to the node; for example, you could use modules like workflow, workbench moderation, or Revisioning to put the node into a different "review" state instead of publishing the node.
Comment | File | Size | Author |
---|---|---|---|
#1 | commerce_node_checkout-use_rules_to_publish_node-2085191-1.patch | 1.32 KB | trigdog |
Comments
Comment #1
trigdog CreditAttribution: trigdog commentedHere is a patch for this functionality. Will have to clear your cache so rules can see the default rule changed.
Comment #2
trigdog CreditAttribution: trigdog commentedchanged status
Comment #4
bunnicula CreditAttribution: bunnicula commentedI need this functionality too. thanks for the patch!
What I'm trying to do is to allow anonymous users to create a node and view their unpublished content. If they like it, they'll be invited to register and purchase a pay-to-publish product.
Is that something I can do with Rules and/or Commerce Node Checkout or do i need custom hooks?
Comment #5
trigdog CreditAttribution: trigdog commentedCommerce Node Checkout should do exactly what you want. It already supports anonymous users to create the nodes and purchase them. You can configure Commerce to have the user register when checking out. If you want them to preview it just require them to preview it through the content type(s) you have configured to your Commerce Node Checkout products. You shouldn't need my patch unless you are wanting to moderate it or do something other than publish the node once the checkout is complete; although, by default the patch still publishes the node when the checkout is complete. This way it doesn't break the current functionality. It just makes it easier to change the functionality through rules.
Comment #6
trigdog CreditAttribution: trigdog commentedComment #7
mstef CreditAttribution: mstef commentedThis completely changes the utility of the Rules plugin 'commerce_node_checkout_publish_associated_nodes' since it's new function would be to just extract the nodes from the order and pass them to the new Rules plugin to publish them.
I like the idea of doing what you said. Can you adjust the patch to make the necessary changes?
Comment #9
mstef CreditAttribution: mstef commentedThanks for your help. I wrapped up the last part I mentioned.
I'll have to remember to include instructions in the next release to make sure people update their Rules, in the case that they've overridden the Rule.
Comment #10
mstef CreditAttribution: mstef commentedThis actually still needs work. The previous code was setting the order owner to be the node owner. Your rule is setting the list item owner to be the order owner.
Comment #12
mstef CreditAttribution: mstef commentedLooks like it was just the names of the set variables that were off.