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 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!

    • By BitPoet
      Here's a small new module that adds a "Manage tags" button to the template list, just like the field list already has.
      Easily add, remove and change tags for your templates.

    • By Noel Boss
      👋 PW Pros…
      I have some hooks that I need to bind at the init phase (or even __construct) and I was wondering, and I couldn't find a good and simple way to determine if I'm in the admin. Would be nice if there is a reliable short option to do so, but I can't seem to find one… Is there a coherent way to tell this no matter where I am?
      Right now, I use the following method inside one of my modules:
      public function isAdmin($page = null) { if ( strpos($this->input->url, $this->urls->admin) !== false || $this->process instanceof ProcessPageList || $this->process instanceof ProcessPageEdit || ($page instanceof Page && $page->rootParent->id == $this->config->adminRootPageID) ) { return true; } return false; } @ryan wouldn't it be nice to have something like wire()->isAdmin(); like wire()->user->isLoggedin(); to tell if we are in admin – very early on (probably even in __construct() phase of modules?
    • By Noel Boss
      Admin Theme Boss
      A light and clear theme based on Uikit 3
      Five unique color options Beautifully redesigned login screens Modern typography using Roboto Condensed Extended breadcrumb with edit links Extends AdminThemeUikit, so you can continue using all current and future AdminThemeUikit features Option to activate theme for all users Compatibility with AdminOnStreoids and other third party modules   Updated and Releases
      There is a shiny new release page where you can subscribe to updates for new releases of AdminThemeBoss.   Color Variants:
      ProcessWire Blue

      Dark Black

      Vibrant Blue

      Happy Pink

      Smooth Green *new with 0.6.1*

      Requires a current ProcessWire version with AdminThemeUikit installed and activated.
      Make sure AdminThemeUikit is activated Go to “Modules > Site > Add New“ Paste the Module Class Name “AdminThemeBoss“ into the field “Add Module From Directory“ Click “Download And Install“ On the overview, click “Download And Install“ again… On the following screen, click “Install Now“

      Manual Installation
      Make sure the above requirements are met Download the theme files from GitHub or the ProcessWire Modules Repository. Copy all of the files for this module into /site/modules/AdminThemeBoss/ Go to “Modules > Refresh” in your admin Click “Install“ on the “AdminThemeBoss“ Module
    • By Clément Lambelet
      I've been working on a Processwire installation (3.0.123) for a few days now and I must have made a big mistake this morning because the links in the admin's main menu no longer appear.
      This is not related to the admin theme, because the bug occurs with all themes (Default, Reno, Uikit).
      I tried to reinstall with the dev version (3.0.136), but the problem is still there. I also uninstalled all the modules I had added, without success. There is no error in the js console. 
      I still can access/view/edit the pages  by going through the admin/page list.
      Thanks in advance for your help!

  • Create New...