+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / The content item has already been checked out by another user and you cannot unlock it

The content item has already been checked out by another user and you cannot unlock it

13 posts, 0 answered
  1. Rico
    Rico avatar
    88 posts
    Registered:
    30 Aug 2012
    30 May 2013
    Link to this post
    Hello,

    Has anybody encountered this issue before (the thread title). I logged into the backend as 'admin' and modified a content item (custom module item) and 'published'. Now, when another user (non-admin) but with privileges to modify the item tries to update it and re-publish, the error appears as a javascript popup.
  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    30 Nov 2016
    04 Jun 2013
    Link to this post
    Hello,

    When editing any content item or page in sitefinity during a user edit the item become locked, tough users with modify permissions can unlock this item and therefore lock it themselves. It appears you are editing an item and at the same time other user have unlocked it, got it locked by himself and you can`t continue publishing changes to it.
    Make sure before attempting further edits to unlock the item (the icon for the item will become green) and after edits will be saved without the error.
    If this is not occurring let me know further details in what set of steps the issue occurs?

    Regards,
    Stanislav Velikov
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Craig
    Craig avatar
    82 posts
    Registered:
    07 Apr 2009
    09 Jul 2013
    Link to this post
    Has anyone found a fix for this issue.  

    I am putting a ticket in with Telerik to see what they have to say about the issue.  
  4. Jared
    Jared avatar
    122 posts
    Registered:
    04 Apr 2013
    28 Aug 2013 in reply to Craig
    Link to this post
    We are experiencing this same issue.  Has there been a fix for this or a known culprit to the problem?

    One workaround is to have an admin go re-publish the page and the Editors are then able to modify and change the item.  The item is showing published when the issue occurs as well, so there is no indication that it is "checked out".  When an item is Locked, we typically see that listed on the item, but for the content items we do not see this.  From my knowledge the "Locked For Editing" only appears on Pages and Page Templates.  I have not seen Content items be in a "Locked For Editing" status.  I only have seen Published and Draft statuses.

    Can someone provide any details on this issue or know a fix?
  5. Craig
    Craig avatar
    82 posts
    Registered:
    07 Apr 2009
    28 Aug 2013 in reply to Jared
    Link to this post
    Jared,

    I am glad you replied because I just got a response from Telerik support on this issue.  They provided me with the following code, although this will need to be modified to fit your situation.  This code will correct one single item.
    01.DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
    02.            Type productGroupType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Products.ProductGroup");
    03.            //get an item with specific url
    04.            DynamicContent productGroupItem = dynamicModuleManager.GetDataItems(productGroupType)
    05.                .Where(p => p.UrlName == "lighting" && p.Status== Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Master).FirstOrDefault();
    06. 
    07. 
    08.            DynamicContent checkOutProductGroupItem = dynamicModuleManager.Lifecycle.CheckOut(productGroupItem) as DynamicContent;
    09. 
    10.            ILifecycleDataItem checkInProductGroupItem = dynamicModuleManager.Lifecycle.CheckIn(checkOutProductGroupItem);
    11.            dynamicModuleManager.Lifecycle.Publish(checkInProductGroupItem);
    12. 
    13. 
    14.            dynamicModuleManager.SaveChanges();

    The following code snippet should be able to fix all items for your content.  I am actually working on a more elegant solution to this fix and I can share this once it is completed.  Hope this helps.  Thanks.
    01.DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
    02.           Type productGroupType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Products.ProductGroup");
    03.           //get an item with specific url
    04.           var productGroupItem = dynamicModuleManager.GetDataItems(productGroupType)
    05.               .Where(p => p.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Master).ToList();
    06. 
    07.           foreach (var item in productGroupItem)
    08.           {
    09.               DynamicContent checkOutProductGroupItem = dynamicModuleManager.Lifecycle.CheckOut(item) as DynamicContent;
    10. 
    11.               ILifecycleDataItem checkInProductGroupItem = dynamicModuleManager.Lifecycle.CheckIn(checkOutProductGroupItem);
    12.               dynamicModuleManager.Lifecycle.Publish(checkInProductGroupItem);
    13. 
    14. 
    15.               dynamicModuleManager.SaveChanges();
    16.           }





  6. Jared
    Jared avatar
    122 posts
    Registered:
    04 Apr 2013
    28 Aug 2013 in reply to Craig
    Link to this post
    Thanks for the code snippet, but we do not want to implement the code every time this situation occurs.  We do have a back-end solution, but would not want any functionality like this in code-behind.  It would still require someone to execute the code.  Hopefully we can get a response from Telerik as to why this happens and what the cause is.  My concern is there is no indicator via the UI that the item is "checked-out".

    Once again, thanks for the information Craig.
  7. Craig
    Craig avatar
    82 posts
    Registered:
    07 Apr 2009
    28 Aug 2013 in reply to Jared
    Link to this post
    Jared,
    Below is the exact response that Telerik gave me before providing the code snippets above.

    The problem occurs because indeed some items (not all) form product groups have been checked out and the check in was not completed. The icon of the item indicates published because modules built with the module builder doesn`t implement item locking (when the item have been checkout it will appear as locked by some user).
    To resolve execute the below query to get the item that encounters a problem and check in this item, change the item url.


  8. Matt
    Matt avatar
    42 posts
    Registered:
    25 Jan 2012
    23 Jul 2014
    Link to this post

    Was there ever a resolution to this besides the code work around?  I have the same issue, currently anytime an editor runs into this situation they call me, I go in and publish the item as an administrator and this clears up the lock for the editor. Is there a certain permission I can give the editor that will basically do the same thing for them?  In other words, which permission specifically as an Admin allows me to just publish it to unlock it for others?

    Thanks!
    Matt

  9. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    14 Aug 2014 in reply to Matt
    Link to this post
    Can only Administrator's role unlock items (pages, news, events, etc) still (without running some code)?  Any update to this in newer released versions?   I am about to make the website admin an Administrator and then have to go and set permissions for her to not be able to go into certain areas. But that's a little scary!
  10. Wagner
    Wagner avatar
    21 posts
    Registered:
    05 May 2011
    15 Aug 2014 in reply to Laura
    Link to this post

    This is a very annoying issue caused by the auto-locking of an item when editing (which imo is a very bad idea/design - it should allow users to select then they want to check out something for edit). 

    The alternative solution I was given is to create a widget that displays the list of locked items and allow the user to unlock it. You can then grant permission to that page for someone below administrator.

    This is an example if you are dealing with dynamic modules:

    [code]

    DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
    Type dynamicModuleType = TypeResolutionService.ResolveType("Your dynamic content type.");
     
    DateTime dueDateTime = DateTime.Now.AddDays(1);
    var items = dynamicModuleManager.GetDataItems(dynamicModuleType)
                    .Where(x => x.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Temp && (x.DateCreated > dueDateTime)).ToList();
                 
    // Note: you should not do SaveChanges on more than 500 items in a single batch.
    items.ForEach(tempItem => dynamicModuleManager.DeleteDataItem(tempItem));
    dynamicModuleManager.SaveChanges();

     [/code]

     

  11. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    29 Nov 2016
    19 Aug 2014
    Link to this post
    Hi Wagner,

    Thank you for sharing solution with the community.

    Regards,
    Svetoslav Manchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  12. Matt
    Matt avatar
    42 posts
    Registered:
    25 Jan 2012
    12 Jan 2015 in reply to Svetoslav Manchev
    Link to this post
    Is there  a way to get around this without using code?  I still have an issue where users are locking each other out of editing a content item in a module that we have built.  Instead of using a module, if I set up a shared content block that they can edit, would that eliminate the problem or could they still potentially lock the content block and then only they or an administrator could unlock it?
  13. Lisa
    Lisa avatar
    2 posts
    Registered:
    02 Dec 2013
    29 Apr 2015
    Link to this post

    There is a Sitefinity feature request for settings to "Enable non Administrators to unlock content items". You can vote for it here:

    http://feedback.telerik.com/Project/153/Feedback/Details/157038-enable-non-administrators-to-unlock-content-items

13 posts, 0 answered