List all locked posts


Please login or register to vote for this query.

(click on this box to dismiss)

Lists all currently locked posts, most recent first.

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

SELECT p.Score,
       p.Id                AS [Post Link],
       p.CreationDate      AS [Creation Date],
       MAX(h.CreationDate) AS [Locked Date],
       p.OwnerUserId       AS [User Link]
FROM   Posts p
       INNER JOIN PostHistory h
         ON h.PostId = p.Id
WHERE  h.PostHistoryTypeId IN (14) -- locked, unlocked
GROUP  BY p.Id, p.Score, p.CreationDate, p.OwnerUserId -- derp?
HAVING SUM(CASE WHEN h.PostHistoryTypeId = 14 THEN 1 ELSE -1 END) > 0 -- locked more often than unlocked

Enter Parameters

Switch to main site
loading Hold tight while we fetch your results