This Snippet is fairly simple, but bypasses docAPI to make the change.
$doc = $modx->getObject('modResource', $resID);
if (!empty($doc))
{ $doc->set('published', '0');
$doc->save();
}
Simply call it with [ [!mySnippetName? &resID=`#`] ].
Note: This does not refresh the cache or perform security checking.
Ben, do you have the pub_date field set? If it's set earlier than today, MODX will republish the document.
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html
@BobRay:
Isn't that only if you have Auto Publishing set to true?
Yes I think so (not sure if Evolution has that setting), but I'm pretty sure it's true by default.
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html
I'm pretty sure it's true by default.
It is definitely true by default.
Hi Guys,
Thanks for the input.
@Fuzzical, that snippet is just giving me a blank page. The snippet call you given is a revo call (I amended to evo and still blank page), I'm guessing thats probably out of habit or is the code itself revo? Should i have any other code within that snippet code?
Ideally want to be using docAPI as that going be to setting a few other things which i've currently stripped out just to try and get the publish working first.
@BobRay no the pub_date is set to 0 and i've also tried turned auto publish on and off.
Thanks again
Ben
-
☆ A M B ☆
- 24,524 Posts
Yes, that's definitely Revo code. Fuzzicallogic has never worked with Evo.
Crap!! I didn't even see that... I'm sorry. I'll go hide in my corner now.