Copied to clipboard

Flag this post as spam?

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


  • Tobias Morf 80 posts 183 karma points
    Oct 12, 2013 @ 17:10
    Tobias Morf
    0

    Cancel Document_BeforePublish event

    When I try to cancel the Document_BeforePublish event with e.Cancel = true I get a YSD.

    We are using 6.1.5

    The error message is:

    [NullReferenceException: Object reference not set to an instance of an object.]
       umbraco.cms.presentation.editContent.ShowMessageForStatus(PublishStatus status) +58
       umbraco.cms.presentation.editContent.Publish(Object sender, EventArgs e) +141
       umbraco.controls.ContentControl.DoSaveAndPublish(Object sender, ImageClickEventArgs e) +158
  • Tobias Morf 80 posts 183 karma points
    Oct 14, 2013 @ 17:12
    Tobias Morf
    0

    I have tried everything (related to http://our.umbraco.org/documentation/Reference/Events/application-startup):

    • ApplicationEventHandler
    • IApplicationEventHandler
    • ApplicationStartupHandler
    • ApplicationBase

    I know that I should use ApplicationEventHandler because of our version (6.1.5) :-)

    Any suggestions?

  • Alexander 3 posts 23 karma points
    Nov 01, 2013 @ 12:10
    Alexander
    0

    Has anyone solved this problem?

  • Tobias Morf 80 posts 183 karma points
    Nov 04, 2013 @ 14:47
    Tobias Morf
    0

    Yes - we had to recompile the Umbraco source. You will find the affected file here: \src\umbraco.cms\businesslogic\web\Document.cs

    Instead of

    return Attempt<PublishStatus>.False;
    

    we wrote

    return new Attempt<PublishStatus>(false, new PublishStatus(Content, PublishStatusType.FailedCancelledByEvent));
    

    You have to change two lines (1031 and 1034).

    Cheers Tobias

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Dec 19, 2013 @ 12:17
    Sebastiaan Janssen
    0

    Hi Tobias, would be awesome if you could send in a pull request with that fix so that you don't have to keep customizing the core for each release!

    Let me know if you need a hand with that.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies