Copied to clipboard

Flag this post as spam?

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


  • Abhishek 15 posts 85 karma points
    Sep 26, 2018 @ 07:40
    Abhishek
    0

    Child node is not meeting IPublishedContent criteria

    When a child node is created under a Content Node, it is showing up in the view even though it is in UnPublished status.

    When publishing the child node and then unpublishing it, then it is not showing up in the view.

    It's like, when a child node is created it's not getting checked for IPublishedContent.

    Could you please help me with this issue.

    Thanks.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Sep 26, 2018 @ 07:54
    Dave Woestenborghs
    0

    Hi,

    Could you answer some questions to see what is going wrong :

    • What version of Umbraco are you using ?
    • Are you creating the node in the backoffice or through code. If through code can you post the code. If through the backoffice can you describe the steps you are taking
    • Can you show the code you use to render the content

    Dave

  • Abhishek 15 posts 85 karma points
    Sep 26, 2018 @ 09:40
    Abhishek
    0

    Hi,

    I am using Umbraco 7.10.3

    I am creating a child node in backoffice

    Steps:

    1. click on create and select a value from it, like, generics
      enter image description here

    2. Fill everything and save it enter image description here

    In info, it is showing status as UnPublished.

    I am using the below code in my view

    LB lb = (LB)ViewData["locationBuilder"];
    IPublishedContent currentPage = CurrentPage;
    IPublishedContent dealer = currentPage.Parent;
    IEnumerable<IPublishedContent> values = currentPage.Descendants().Where(x => x.DocumentTypeAlias == "generics");
    

    I have also tried with below code

    var dealer = Model.Content.Parent;
    var values = dealer.Children().Where(x => x.DocumentTypeAlias == "generics");
    

    Both are returning the saved content to my view

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Sep 26, 2018 @ 10:53
    Dave Woestenborghs
    0

    Hi,

    Did you click the Save and Publish button or just Save ?

    Can you try to reproduce it in a clean umbraco install with the starter kit installed ?

    Dave

  • Abhishek 15 posts 85 karma points
    Sep 26, 2018 @ 10:59
    Abhishek
    0

    Hi,

    I have just saved it.

    I don't think I can, it is something my firm is using.

    When we manually unpublish a child node, that's not showing up, but the saved ones are.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Sep 26, 2018 @ 11:19
    Dave Woestenborghs
    0

    When we manually unpublish a child node, that's not showing up, but the saved ones are.

    So you say you can unpublish it, so that means it is published. Otherwise you would not have the option to unpublish it.

    Dave

  • Abhishek 15 posts 85 karma points
    Sep 26, 2018 @ 11:51
    Abhishek
    0

    No, I am talking in general. The published ones when unpublished are fine, but the saved ones are with the unpublished status and still showing up

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Sep 26, 2018 @ 12:20
    Dave Woestenborghs
    0

    Hi,

    I just tried to reproduce it on a clean install of 7.10.3 with the starter kit installed and can't reproduce this behavior.

    Do you have maybe some custom code or packages in place that could "autopublish" these ?

    Dave

  • Abhishek 15 posts 85 karma points
    Sep 26, 2018 @ 13:48
    Abhishek
    0

    Hi,

    Yes, we have a API call to autopublish child nodes. When there is dirty data(i.e., change in SortOrder, description etc), the child nodes get AutoPublished, even the saved ones.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Sep 26, 2018 @ 14:19
    Dave Woestenborghs
    0

    So that probably explains why you see them on the front end... they get published by this api call.

    Dave

  • Abhishek 15 posts 85 karma points
    Sep 26, 2018 @ 15:13
    Abhishek
    0

    No. When there is no dirty data, API call is not made, it is just getting saved with status as unpublished.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Sep 26, 2018 @ 15:48
    Dave Woestenborghs
    0

    When you create a new node and save it, I think the data is dirty and it will autopublish.

    Maybe you can post the code of your API ?

    Also what is the reasoning behind the autopublishing ?

    Dave

  • Abhishek 15 posts 85 karma points
    Sep 26, 2018 @ 16:03
    Abhishek
    0

    The reason why we are using dirty data check is, if the order is changed for the child nodes (re-arranged), the re-arranged order should show in view.

    I have commented the dirtydata check and checked it, now the saved one didn't get published, it's in unpublished status, but the issue still persists, it is showing in my front end.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Sep 26, 2018 @ 19:23
    Dave Woestenborghs
    0

    Can you post the code of your API.

    What you are describing is not out of the box behavior. So I think it's your api call that is causing this.

    Does it work correclty when you disable your api ?

    Dave

  • Abhishek 15 posts 85 karma points
    Sep 27, 2018 @ 10:27
    Abhishek
    0

    Yes, it is working fine.

    When I create a child node it is in Unpublished status. Please find the attached image.

    enter image description here

    It is still showing up in my view.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Sep 27, 2018 @ 10:34
    Dave Woestenborghs
    0

    But can you please post some code from your api that does that the autopublish.

    That way I can try to reproduce it.

    Dave

  • Abhishek 15 posts 85 karma points
    Sep 27, 2018 @ 11:17
    Abhishek
    0
     if (childNode.HasDirtyData)
                {
                  var n = UmbracoRepository.GetContentNode(auth, childNode.ContentNodeId, contentPage.SiteRootNodeId);
                  sortOrder = SortOrder;
                  success = UmbracoRepository.SaveAndPublishContent(n);
                 }
    
  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Sep 27, 2018 @ 11:28
    Dave Woestenborghs
    0

    This seems only a part of the code.

    Please post the full code. How is this handled ? Is it through a content service event etc...

    Without more information I'm afraid I can't help you.

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft