I have a snippet which allows my site users to post comments on parts of my site using an SMF forum. But I need to make it so the page knows whether a thread is already made and the comment should be a reply, or if a new thread needs to be made.
I set up a check box TV with a default value of ’false’ and an input of ’true’.
Does anyone know how I could change the value of this TV with a snippet?
Also is there a way of disabling the checkbox on my TV so only the snippet can change it? (I’m new to modx)
TIA
UPDATE:
I found the solution myself.
Found the tv with:
$myTV = $modx->getObject('modTemplateVar',array('name'=>'TVNAME'));
Got the documents id.
$docID = $modx->resource->get('id');
Then set and saved it usingit useing:
$myTV->setValue($docID, 'NEW TV VALUE');
$myTV>save();
I hid the template variable in the resoruce edit/create page using the options in
system -> form customisation.