New post field problem - not defined in $validfields
I have added a new field to the 'post' table. This field gets set when a new post is made. However, when I try to moderate any new post which will update this new field, I get:
Fatal error: Field testfield1 is not defined in $validfields in class vb_datamanager_post in /includes/class_dm.php on line 485
First thought was "no problem, just add the new field name to the $validfields array in class_dm.php". But it IS a problem :disappointed: - I can't work out how I add this new field, testfield1, to the array.
Any help is much appreciated.
Thanks.
An update:
OK. Still need help.
What I've done so far:
Created a plug-in in hook location postdata_postsave. plug-in code is:
$testfield1 = $_REQUEST['ratefield1'];
$pupdate = "UPDATE post SET testfield1 = '$testfield1' WHERE postid = '$postid'";
$pupdo = mysql_query($pupdate);
This writes the value of the new form field to the post table. And works fine.
However, I want to 'moderate' these new posts. And this is where the problem is.
When I try to moderate the posts in AdminCP, it always fails with error message:
"Fatal error: Field testfield1 is not defined in $validfields in class vb_data_manager in /includes/class_dm.php on line 485".
To get it to moderate properly, I have added the following plug-in to hook location postdata_start:
$this->validfields['testfield1'] = array(TYPE_NUM, REQ_YES);
The post can now be moderated ok. BUT, I can no longer submit new posts! newreply.php always fails with error message:
"Fatal error: Unable to proceed with save file while $errors array is not empty in class vb_datamanager_post in /includes/class_dm.php on line 758"
The only way to get the new posts to submit, is to disable the "validfields" plug-in.
So Catch 22.
Any ideas?
Thanks. Iain
|