Good work!
Is this a great community, or what?
perhaps something like that will do it:
<?php//remove this line, only for sytnax-highlighting
$rs=$modx->db->select('id',$modx->getFullTablename('site_tmplvars'),'name="status"');
$row=$modx->db->getRow($rs);
//$modx->logEvent('1','1',print_r($_POST['tv'.$row['id']],true));
if (in_array($_POST['tv'.$row['id']], array ('4', '34', '27')))
{
$parent = $_POST['tv'.$row['id']];
if ($parent !== $_POST['parent'])
{
//make sure parent is container and published:
$modx->db->update( array ('isfolder'=>'1', 'published'=>'1'), $modx->getFullTablename('site_content'), 'id='.$parent);
//move resource to new container:
$modx->db->update( array ('parent'=>$parent), $modx->getFullTablename('site_content'), 'id='.$params['id']);
}
}
-
☆ A M B ☆
- 24,524 Posts
isfolder
I don’t think it has to be published, it’s just that isfolder is used when building the Tree display.
For the life of me, I cannot get this to work. I have spent *hours* trying. Is the above code just not compatible with Revo 2.2.4?
What happens: after creating this plugin, when I have "OnDocFormSave" checked, I can no longer save *any* resource on the site. I get the endless "Saving" progress bar. If I uncheck "OnDocFormSave", I can save resources again but of course can't use the plugin. Here's the weird part: even if I have the plugin disabled, it will still prevent resources from saving if I have "OnDocFormSave" checked. Nothing shows up in the error log either.
Any ideas? Thanks.
Yes, that's a two-year-old message and the code is for MODX Evolution. I'm not sure what the Revolution code would look like for that.
You're more likely to get help if you start a new thread, since this one is marked as solved.
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html