I'm running a site on Umbraco 4.0.4.2 and have tested the Publish at and Remove at dates. I created a new page, entered a publish at date of a couple hours later, and saved (didn't publish). When I came back into Umbraco after the publish at date had passed, the item showed as published, but still threw a 404 error. When I right-clicked on the content node and did a "republish entire site," then the page worked fine.
So, it looks like it published in terms of status, but didn't really publish in that it didn't update umbraco.config? Am I doing this incorrectly?
I am almost facing the same problem, running Umbraco 4.0.4.2.
It seems to me that the published flag is still set to Published = true. When the the document gets automatically unpublished is it unpublished using umbraco.library.UnPublishSingleNode? If so, why?
To solve this problem I created an AutoUnPublishHandler
This will run every time a document is automatically unpublished. But I am not sure if this is the right way to solve the problem.
public class AutoUnPublishHandler : umbraco.BusinessLogic.Actions.IActionHandler {
public bool Execute(umbraco.cms.businesslogic.web.Document documentObject, umbraco.interfaces.IAction action) {
if (action.Alias == umbraco.BusinessLogic.Actions.ActionUnPublish.Instance.Alias) {
// When the document is automatically unpublished the published flag will still be set to true. if (documentObject.Published) {
//Run unpublish on the document so that the published flag is set to false. documentObject.UnPublish();
// Tell the published XML content that the document has been unpublished. umbraco.library.RefreshContent(); } } }
public string HandlerName() { return "AutoUnPublishHandler"; }
public umbraco.interfaces.IAction[] ReturnActions() { return new umbraco.interfaces.IAction[] { umbraco.BusinessLogic.Actions.ActionUnPublish.Instance }; } }
It looks like the issue might be that umbraco.library.RefreshContent() isn't called when the scheduler auto publishes or unpublishes? Is this a confirmed issue or am I doing something incorrectly? (I haven't looked at the source code for 4.0.4.2 to confirm/deny this). Erik, has the above code solved your problems? I think I'd need to create a similar handler for auto publish as well as unpublish?
Publish at and Remove at Dates Question
I'm running a site on Umbraco 4.0.4.2 and have tested the Publish at and Remove at dates. I created a new page, entered a publish at date of a couple hours later, and saved (didn't publish). When I came back into Umbraco after the publish at date had passed, the item showed as published, but still threw a 404 error. When I right-clicked on the content node and did a "republish entire site," then the page worked fine.
So, it looks like it published in terms of status, but didn't really publish in that it didn't update umbraco.config? Am I doing this incorrectly?
Thanks,
Matt
I am almost facing the same problem, running Umbraco 4.0.4.2.
It seems to me that the published flag is still set to Published = true.
When the the document gets automatically unpublished is it unpublished using umbraco.library.UnPublishSingleNode?
If so, why?
To solve this problem I created an AutoUnPublishHandler
This will run every time a document is automatically unpublished. But I am not sure if this is the right way to solve the problem.
public class AutoUnPublishHandler : umbraco.BusinessLogic.Actions.IActionHandler
{
public bool Execute(umbraco.cms.businesslogic.web.Document documentObject, umbraco.interfaces.IAction action)
{
if (action.Alias == umbraco.BusinessLogic.Actions.ActionUnPublish.Instance.Alias)
{
// When the document is automatically unpublished the published flag will still be set to true.
if (documentObject.Published)
{
//Run unpublish on the document so that the published flag is set to false.
documentObject.UnPublish();
// Tell the published XML content that the document has been unpublished.
umbraco.library.RefreshContent();
}
}
}
public string HandlerName()
{
return "AutoUnPublishHandler";
}
public umbraco.interfaces.IAction[] ReturnActions()
{
return new umbraco.interfaces.IAction[] { umbraco.BusinessLogic.Actions.ActionUnPublish.Instance };
}
}
It looks like the issue might be that umbraco.library.RefreshContent() isn't called when the scheduler auto publishes or unpublishes? Is this a confirmed issue or am I doing something incorrectly? (I haven't looked at the source code for 4.0.4.2 to confirm/deny this). Erik, has the above code solved your problems? I think I'd need to create a similar handler for auto publish as well as unpublish?
Thanks,
Matt
is working on a reply...