Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • NSC 23 posts 123 karma points
    Aug 10, 2023 @ 07:42
    NSC
    0

    Unpublishing multi-language nodes - no ContentUnpublishedNotification until last language

    Hi,

    When clicking "Unpublish" and selecting one the available cultures of the node, no ContentUnpublishedNotification will be caught in my handler until the very last culture is unpublished.

    No notification sent once the first 2 cultures are unpublished:

    enter image description here

    Once the last culture is published, a notification is sent:

    enter image description here

    How do I find out a culture has been unpublished then? Is there a different notification for culture modifications?

  • Marc Goodson 2141 posts 14344 karma points MVP 8x c-trib
    Aug 10, 2023 @ 09:03
    Marc Goodson
    1

    Hi NSC

    Yes the ContentUnpublished notification only fires when the entire document is unpublished, if a culture remains then part of it is still published..

    There is though, a set of extension methods:

    https://github.com/umbraco/Umbraco-CMS/blob/0edee82b0b92876ef336a04fa82eb48832302523/src/Umbraco.Core/Notifications/ContentNotificationExtensions.cs#L34

    Which you can access during a 'publishing notification' to determine whether the publishing has been triggered by the act of u publishing a culture...

    (it's a bit counter intuitive but unpublishing a culture needs to update the published cache, and therefore triggers the publishing notifications)

    So you can check in the publishing notification using HasUnpublishingCulture and then use IsUnpublishingCulture to determine which one...

    Regards

    Marc

Please Sign in or register to post replies

Write your reply to:

Draft