Jump to content

Publish New Pages by Default in Admin Interface

Recommended Posts

The basic Processwire workflow assumes that I (as an Editor) want to save new Pages in draft mode - and therefore new pages are always set to unpublished by default. To publish the page, it is necessary to actively press "Publish", otherwise the Page will not be visible.

The workflow is:

  1. Add new Page
  2. Status is now "Unpublished: Not visible on site."
  3. Press Publish - the page is now visible on site

I want to publish pages right away (without having to press Publish).
Where is that configured?

ProcessWire 3.0.123
Uikit v3 admin theme (0.3.0)

Share this post

Link to post
Share on other sites

You may rename the Save and Publish buttons... 😉

The first "save" only creates the page in page tree and assigns the template to it. You can not actually enter any content upon page creation, so keeping the page unpublished seems very reasonable to me. Maybe the Save button could be named "Create" to better reflect what happens. At this moment the page really should not be published automatically, since it may contain required fields, where your template code rely on.

With the template assigned, you'll have fields to enter content and see the Publish button. After entering the data you press "Publish", which effectively is "Save+Publish" in this case. I don't see an extra step to publish a page after entering its content, since this already is the default.

Only in case the selected template does not have additional fields you'll see additional Save+Publish buttons. Are we talking about this situation?

  • Like 2
  • Thanks 1

Share this post

Link to post
Share on other sites

if you have $config->advanced = true in your site/config.php file, then you'll see some addtl. fields in template > advanced:


Although I would also be careful with that.

  • Like 2
  • Thanks 1

Share this post

Link to post
Share on other sites

Putting this in your ready.php or admin.php should do it. You may want to add additional checks for admin only (not via API).

$this->addHookAfter('Pages::added', function($event) {
    $p = $event->arguments[0];

But, @Autofahrn has some excellent points about publishing a page which doesn't have any content other than the title, so use this with caution!

  • Like 1
  • Thanks 1

Share this post

Link to post
Share on other sites

Excellent suggestions. Thanks to all.
@adrian, your solution works like a charm:

  1. Press New
  2. Set Title and Name (Template is currently unassigned)
  3. Press "Save" - Page now gets published with the chosen template, all template fields are blank.

Setting pages to unpublished is still possible.
This is how I want the flow.

  • Like 1

Share this post

Link to post
Share on other sites

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By DanielKit
      Hi. I'm currently stuck at the login page in my project. Once I enter my admin username and my password and press login, nothing happens. The page just reloads. However, the URL changes from http://myipaddress/processwire to http://myipaddress/processwire/?login=1. I've checked all of my server settings, and to my knowledge, all seems to be fine there. I don't know where to go from here.. Thanks in advance!
    • By modifiedcontent
      Small annoyance: I get a horizontal scrollbar in UIkit admin area - or actually Admin Theme Boss based on Uikit 3. I tried to fix it with CSS, but had trouble isolating/targeting it and don't want to mess with module or core files. I think this issue has been reported before. Is there a recommended fix? 
    • By codevark
      The Minimal Site works fine, but if I try to login as admin, I have no idea what the credentials are.
      I did not do the "install" process myself. The OVA came with everything set up, but there's no mention of the PW admin credentials being set to some initial value.
      Wondering if anyone else has tried the Bitnami OVA and if there's a simple answer.
    • By vwatson
      I don't have any fontawesome icons in the admin section. Not sure what's wrong. They used to appear. I've tried all the user profiles and they're gone in all of them.
      Using the browser inspector tool, I see this message:
      Access to font at 'https://www.domain.com/wire/templates-admin/styles/font-awesome/fonts/fontawesome-webfont.ttf?v=4.7.0' from origin 'http://domain.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
      I'm not sure why this is occurring or how to fix it. Any help would be greatly appreciated. 
    • By Andi
      Getting a little deeper into the ProcessWire state-of-mind here. I seriously think I wouldn't have come back to webdev if it wasn't for this wonderful little gem of a CMS.
      I have an "Options" field added to all users on a site. If the user has anything other then "default" selected, I would like to show a permanent message in the admin like the one in the screenshot, only so that the user can't close it. As a friendly reminder that he changed that option from default to something crazy 🙂
      I've read up on how to send messages to users, but where would I hook into to make this show up all the time in the backend?
      Thanks in advance!

  • Create New...