Hi,
I've finally finished developing my article_node module.
However, I feel a little bit uneasy about it. Rhe main reason is that I am not 100% sure that I did things "right".
My main question is: how much logic should go into node_article_insert and node_article_update?
At the moment, I allow people to specify an editor for the article. Obviously, in the form the editor is specified by account name rather than UID.
So, in node_article_update I have something like:
// Work out the node_id for the chosen editor
if($node->editor_uid_name == ''){
$node->editor_uid=0;
} else {
$tmp=user_load(array('name' => $node->editor_uid_name));
$node->editor_uid=$tmp->uid;
}
Then, I decided that if the editor is not sent then the editor CANNOT be "ok" with the article. So, later on in node_article_update, I have:
if($node->editor_uid == 0){ $node->editor_ok = 0; }
And then things get worse...
In the form, I have an hidden field:
$form['workout_oks'] = array('#type' => 'hidden', '#default_value' => '1', '');
This field will tell my module that I want to work out who's OK with what (if a new version of the node is saved, then the author's OK is automatically set to 0).
In node_article_update, I then have:
if($node->workout_oks == 1 && $op == 'update'){
_node_module_reset_other_peoples_oks($node);