Jump to content
Soma

Page save silently

Recommended Posts

I seen this a couple times here by Ryan but can't find it. There a method to save a page silently so it doesn't update modified or user when saving a page.

Was it $page->save(false) ? Anyone remember?

Share this post


Link to post
Share on other sites

Yeah I think that was it. Just tested and seems to work. Thanks!

Share this post


Link to post
Share on other sites

These should also work (on dev): 

// save directly from page object
$page->save(array('quiet' => true));

// save just 1 field from page object
$page->save('myfield', array('quiet' => true)); 

When quiet mode is set, the modified date is set to whatever is specified in the page. Meaning, the modified date is not updated unless you change it yourself. Quiet mode also lets you modify the modifedUser and createdUser for the page, if you want to. These are two properties you can't usually modify, but quiet mode lets you do it. 

  • Like 9

Share this post


Link to post
Share on other sites

Great to have that options array for the save method.

I just discovered this when trying to set the modifiedUser of a page.

Had to do a google search and read some forum posts until I finally found it here. Would be really great, if this was mentioned in the cheat sheet for

http://cheatsheet.processwire.com/pages/built-in-methods-reference/pages-save-page/ ,

http://cheatsheet.processwire.com/page/built-in-methods-reference/page-save/

and http://cheatsheet.processwire.com/page/built-in-methods-reference/page-save-field/

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.

×
×
  • Create New...