Jump to content

[SOLVED] Creating a new page status


Jhin
 Share

Recommended Posts

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 by Jhin
SOLVED!
Link to comment
Share on other sites

@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.

 

Link to comment
Share on other sites

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!

  • Like 1
Link to comment
Share on other sites

  • Jhin changed the title to [SOLVED] Creating a new page status

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...