Jhin Posted October 19, 2023 Posted October 19, 2023 (edited) Hello All, I've searching if there is any way to add a new status for a page. My web is very user based and I need another status page called "unapproved" for moderation purposes. I've tried looking at the API and also looking at this forum, but I did not find nothing. The code below produces this error: Warning: A non-numeric value encountered $page->addStatus('unapproved'); if ($page->hasStatus('unapproved')) { echo "Unapproved"; } else { echo "Error"; } Edited October 19, 2023 by Jhin SOLVED!
ngrmm Posted October 19, 2023 Posted October 19, 2023 @Jhin AFAIK there is fixed number of status options (locked, unique, hidden, unpublished, …) which you can set or check. Therefore you could add a checkbox field to your template. Then you could set the status in the backend or via API.
Jhin Posted October 19, 2023 Author Posted October 19, 2023 Hello ngrmm I just found a workaround based on your input. class blogPost { const statusUnapproved = '16385'; } $page->addStatus(blogPost::statusUnapproved); if ($page->hasStatus(blogPost::statusUnapproved)) { echo "Unapproved"; } else { echo "Not Unapproved"; } Thank you for the help! 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now