BLUblog status, access codes and revisions - Philip1806/blublog GitHub Wiki
BLUblog status is a big feature that it's probably pointlessly overcomplicated. But in some cases can be very useful.
The status is like role and have it's permissions. Settings are in blublog config file.
Post Status Settings
You can add as many posts status as you want in "post_status" setting. For each addition you need to add element in settings - "post_status_access", "post_status_edit" and "post_status_revisions" Post status "publish" and "waits" are reserved and must exist.
Post Access Codes
0 - public. Post with that status code can be seen by all.
1 - Restricted. Only seen by mods and admin.
2 - Private. Only seen by the author.
3 - Custom. Blublog will check if user have permission "view-{your-post-status}"
Post Edit Codes
0 - Can be edited by all users.
1 - Restricted. Post author, mods and admin can edit post.
2 - Custom. Blublog will check if user have permission "edit-{your-post-status}"
Post Revision Setting For Post Status.
Set number of max revisions per post status.
- true - blublog will keep ALL revisions of post with that status.
- INT - The number of revisions that should be keeped for that status.
- false/0 - blublog will NOT keep revisions of post with that status.
Post status in code
You can give post status in parameter in methods like search in Post Service. Will return empty if user do not have permission to get posts with that status. If status is marked as private, the search will be done in posts of current user.
Other functions will ignore post status permissions, so you need to use statusIsPrivate(), canView(), isValidStatus(), getAccessCodeForStatus() and others.
Make sure post status is valid, because functions above will throw InvalidPostStatusException.