Added lock to permalink if entry/post was published

Changes from Andy commited before, changes were lost somehow