The content item has already been checked out by another use

Posted by Community Admin on 03-Aug-2018 21:07

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

All Replies

Posted by Community Admin on 30-May-2013 00:00

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.

Posted by Community Admin on 04-Jun-2013 00:00

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

Posted by Community Admin on 09-Jul-2013 00:00

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.  

Posted by Community Admin on 28-Aug-2013 00:00

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?

Posted by Community Admin on 28-Aug-2013 00:00

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.           





Posted by Community Admin on 28-Aug-2013 00:00

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.

Posted by Community Admin on 28-Aug-2013 00:00

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.


Posted by Community Admin on 23-Jul-2014 00:00

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

Posted by Community Admin on 14-Aug-2014 00:00

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!

Posted by Community Admin on 15-Aug-2014 00:00

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]

 

Posted by Community Admin on 19-Aug-2014 00:00

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
 

Posted by Community Admin on 12-Jan-2015 00:00

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?

Posted by Community Admin on 29-Apr-2015 00:00

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

feedback.telerik.com/.../157038-enable-non-administrators-to-unlock-content-items

This thread is closed